Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    [SOLVED] Crontab not working

    I've created a crontab to run a php script (daemon) at boot.

    crontab -l:
    (at)reboot /usr/bin/php-cgi /var/backbone/fork_sema.php 2>&1 > /dev/null
    (at)reboot export EDITOR="vi"
    When I run the command as root it works. I've added "#!/usr/bin/php-cgi -q" to the beginning of the file. I've also tried to putting "root" before the command, which I've now removed. The command is executed at boot, but the script is not running.

    The second command doesn't work either.

    Any suggestions? Thanks..

  2. #2
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    3rd rock from sun - Often seen near moon
    (at)reboot export EDITOR="vi"
    Which distro are you using? Are you trying at command? .Check this link.
    A quick and simple guide to crontab usage -
    for crontab examples
    First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    FOSS India Award winning ext3fs Undelete tool Online Linux Terminal

  3. #3
    Problem found.

    Apparently cron runs before mysql. My php script quits because it is unable to connect to the db.

    Fix: Put a sleep before connection attempt.

    I also was able to make the default editor change permanent by editing ".bash_aliases".


  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts