Beste WHT'ers,
Eerste poging voor iets geautomatiseerd te laten verlopen via cron...en uiteraard...fail! Echter geen idee waar het zit (logs zeggen niks)
1. Het script is vrij simpel, alle regels apart werken
2. nadat het script is aangemaakt, is het uitvoerbaar gemaakt (chmod +x bestand.sh)
3. als ik het script manueel uitvoer, komt het wel goed?
Wat het script moet doen:
1. elke 5 minuten het bestand "config.txt" downloaden van http://config.smokeping.me/config.txt
2. bestand "config.txt" verplaatsen (+hernoemen) naar /opt/smokeping/etc/config
3. smokeping herstarten
Het script zelf
manueel uitvoeren van het scriptCode:#!/bin/bash echo "*** Download of the current Smokeping configuration file ***" wget -O config.txt http://config.smokeping.me/config.txt echo "*** Move downloaded config file to Smokeping directory ***" mv config.txt /opt/smokeping/etc/config echo "*** Restart Smokeping ***" service smokeping restart
RechtenCode:[root@v02 /]# sh /home/smokepingme.sh *** Download of the current Smokeping configuration file *** --2014-09-07 02:34:27-- http://config.smokeping.me/config.txt Herleiden van config.smokeping.me... 85.234.197.11 Verbinding maken met config.smokeping.me|85.234.197.11|:80... verbonden. HTTP-verzoek is verzonden; wachten op antwoord... 200 OK Lengte: 8381 (8,2K) [text/plain] Wordt geschreven naar: `config.txt' 100%[======================================>] 8.381 --.-K/s in 0,005s 2014-09-07 02:34:27 (1,67 MB/s) - '`config.txt'' opgeslagen [8381/8381] *** Move downloaded config file to Smokeping directory *** *** Restart Smokeping *** Stopping SMOKEPING: [ OK ] Starting SMOKEPING: WARNING: Hostname 'test.krisa.be' does currently not resolve to an IPv6 or IPv4 address Note: logging to syslog as local0/info. Daemonizing /opt/smokeping/bin/smokeping ... [ OK ]
Crontab -eCode:[root@v02 home]# ls -ll totaal 20 -rwxrwxrwx. 1 root root 0 sep 7 02:23 cronlog.log drwx------. 2 root root 16384 sep 6 17:57 lost+found -rwxr-xr-x. 1 root root 305 sep 7 01:43 smokepingme.sh
Code:*/5 * * * * sh /home/smokepingme.sh >> /home/cronlog.log 2>&1

Likes:


Quote