How To Start Ghost With Cron Job

If you want to start your Ghost process with a cron job, you can use the @reboot feature of cron.

Make sure the crontab that you edit has read and write access to your Ghost directory

To edit your crontab run crontab -e and add the following:

@reboot /usr/local/bin/npm start /path/to/ghost/

Note that this cron job will start Ghost when the system boots up but will not automatically restart Ghost if it crashes. You can use cron to execute your forever ([how to setup forever to start ghost (/how-to-start-ghost-with-forever "article on how to setup forever to start Ghost and keep it running") script to.

Be sure to replace the path to npm to match your system. You can check the path to npm on your system by running which npm. Also replace /path/to/ghost/ with the path to your Ghost directory.

After a reboot you can check and see if your Ghost process is running by executing

 ps aux | grep npm | grep -v grep

and you should see output similar to:

 root  1066  0.0  0.0   4400   600 ?   Ss  13:15   0:00 /bin/sh -c /usr/local/bin/npm start /path/to/ghost/
 root  1068  0.3  0.2 825840 23664 ?   Sl  13:15   0:00 npm