2

I am writing a python program to go on the raspberry pi. I am currently making an installation script that will as part of its installation process, add a line on cron so that it will automatically startup on bootup.

I need access to the whole file, not just adding a line at the end. As I want the ability to uninstall the program, which will in part remove the line in the crontab.

  • This question belongs on our larger sibling site Unix & Linux. However, before you bother to do that I suggest you make some effort to do some basic research yourself; cron has been around for decades (the version used in Raspbian is I think older than the WWW) and is extensively documented. I will give you a quick clue by citing the 3rd paragraph in man crontab: "...system cron jobs in the /etc/cron.d/ directory". – goldilocks Jul 28 '15 at 16:04
7

Like most Debian based systems, the crontab is stored in /var/spool/cron/crontabs

On a different note: Why are you trying to start your program using crontab? This is neither a good nor a standard practice. If you're going through the effort of writing an installer, you should be using an init script so that the user has the ability to issue start/stop/restart commands as needed.

  • 2
    I think /var/spool is used for per-user crontabs. The system jobs are in /etc/cron.d and also /etc/cron.[hourly|daily|monthly]. – goldilocks Jul 28 '15 at 16:06
  • Oh, interesting. I assumed the system crontab would have been stored as a user tab under root or something. Thank you for the clarification. – Jacobm001 Jul 28 '15 at 16:09
  • When running sudo crontab -e, so for root, the crontab is stored here: /var/spool/cron/crontabs/root. Probably /etc/cron* is used for systemd only. – monok May 28 at 7:36

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