0

I have a Raspberry PI running Raspbian. I use Apache to host my web site. I use Pelican to generate the site content. I can log in to my PI via SSH, navigate to the directory where the source files are stored in markdown format and issue the following command :

pelican content -r -s publishconf.py

This will keep Pelican running and watching for changes, which is great as I can now upload new articles and my site is updated automatically.

I'd like this command to be run at system startup, in case I ever need to reboot. What is the simplest way that I achieve that?

0

What is the simplest way that I achieve that?

To /etc/rc.local add:

(
    cd /whatever/source/path
    exec pelican content -r -s publishconf.py   
) &> /var/log/pelican_local.log &

This will run pelican root; if you want to use a different (less privileged) user, throw su whoever in before the last exec, and change the log path to somewhere writable for them. The log is just for the purpose of debugging this snippet in case it does not work to do what you want; if everything works and the pelican command itself doesn't produce output, it will remain empty.

Make sure you don't forget the final & there unless you are certain pelican backgrounds itself.

Not the answer you're looking for? Browse other questions tagged or ask your own question.