Aller au contenu
Infogérance Linux Debian en France

Infogérance Linux Debian en France

Kogitae : Ingéniérie de l'hébergement Internet

  • Accueil
  • Parcours
  • Presse
  • Portfolio
  • Blog

X.Y.Z: How to debug or test cron script

  • Accueil » Blog » X.Y.Z: How to debug or test cron script
Dansbash, Debian

X.Y.Z: How to debug or test cron script

How to debug or test cron script

If your simple cron script (/etc/cron.daily, etc/cron.hourly etc) does not run as expected, do the following:

1. be sure to have ‘#!/bin/sh’ as the first line

2. make sure the script’s name does not contains ‘.’. for example, you should rename ‘yourscript.sh’ to ‘yourscript’.

3. use absolute path if you need to read/write files in the script

4. try run the script in the shell to make sure there is no obvious problem

5. ‘run-parts –test /etc/cron.hourly/’ will tell you what scripts will run, you should see your script in the list

6. next try to run it like cron does, for example:

cd / && run-parts –report /etc/cron.hourly

7. cron uses syslog for logging. Check your syslog config file ( /etc/syslog.conf) to see where the log is, and check the log for errors.

viaX.Y.Z: How to debug or test cron script.

cron cron-how-to-test crontab-bash-debug crontab-test-execution debug executer-crontab-test how-to-test-crontab howto-test-a-crontab-script logger-bash-syslog script test-cron tester-cron

Étiquettes

administrateur-systeme-freelance (9) amazon (3) apache (14) asterisk (9) auth (3) bash (6) blog-administrateur-systeme (14) blog-administration-systeme (4) collectd (5) cpu (3) debian (30) dovecot (4) duplicate (3) f (6) freelance-asterisk (3) google (3) infogerance-linux (5) infogérance (4) ipv6 (7) kernel (4) kogitae (30) kogitae-com (3) kogitae-fr (6) lamp-or-linux-or-developpement-web-and-apache-or-php-or-mysql-or-adobe-or-eclipse-or-zend-or-mozilla-or-firefox (17) lenny (4) lighttpd (5) limit (4) linux (26) mail (7) mdadm (6) mysql (14) openvz (9) optimiser (4) php (5) postfix (11) privvmpages-openvz (3) pxe (3) raid (3) SEO (5) ssh (8) ssl (3) test (3) voip (4) wordpress (6) www-kogitae-fr (7)