When I execute cron I get this fault

cron: can't open or create /var/run/crond.pid: Permission denied

So, how to do it without cron?

P.S. I want to check if file in svn has changed and I have a special script for it.

  • If you do not have permission, then try run cron with sudo. – Anonymous Nov 25 '11 at 18:22
  • 4
    Bear in mind cron won't do something every 10 seconds, the most granular it gets is once a minute. – Caesium Nov 25 '11 at 19:07
  • If you want to make cronjobs, you've to run crontab -e to start the editor. To list the current crons, run crontab -l – Lekensteyn Nov 25 '11 at 21:09
  • @Anonymous i don't know root password, so sudo won't help me. – UAdapter Nov 26 '11 at 14:00

To access your personal cron configuration you should use the command crontab -e (to edit your cron table).

Alternative is the watch command:

watch -n10 command args

Finally, to monitor filesystem events more effectively, you could use inotifywait, from inotify-tools package.

  • 2
    It's worth noting, perhaps, you would better wrap your command(s) inside double quotes or you may end up with unexpected results. watch -n<timeout> "command(s) arg(s)" like watch -n2 "ps ux | grep ss5" – Achilles Nov 10 '18 at 10:58
  • I found it hard to get watch to accept long, complicated commands using pipes and quotes. The while loop below worked, but of course one should always sleep first to avoid runaway pids. – rjurney Apr 25 '19 at 23:48
  • @rjurney: it should be enough to wrap the whole command in quotes, single or better double: watch -n10 "ls -l | grep $foo" – enzotib Apr 26 '19 at 6:15
  • @enzotib The problem comes when there are quotes in the commands, as quotes within quotes within (god help me) quotes approaches impossible in bash. In theory it should be possible but I rarely achieve nested quotes in bash without giving up and going a different route. – rjurney Apr 28 '19 at 2:08

You can write a shell script that has sleep in a while loop.

while [ true ]
    sh special_svn_script.sh
    sleep 10
  • 5
    while true does not require square brakets, otherwise "true" is interpreted as a string, and every string is as good as "true". – enzotib Nov 25 '11 at 19:16
  • 1
    @enzotib so you might as well write while around – Eduard Florinescu Apr 27 '16 at 12:59
  • 1
    While this works you should always sleep first because something may occur causing the sleep step not to be reached, in which case you've got a runaway pid flooding something. – rjurney Apr 25 '19 at 23:49

gnome-schedule (click the button to Install now! using your Software Center)
is a graphical user interface that leverages the power of vixie-cron, dcron and at to manage your crontab file and provide an easy way to schedule tasks on your computer. It supports recurrent (periodical) tasks and tasks that happen only once in the future. It is written in Python using pygtk.

Awesome features

  • Supports custom titles and icons for your tasks so that they are more easily to keep track of
  • Templates support so that you won't have to create the same task again and again; these are saved in gconf and may easily ship them with, say, a Linux distribution
  • If run as root, you can edit any user's crontab and "at" tasks.
  • Human-readable strings like "Every hour" instead of "0 * * * *"
  • Advanced mode for crontab experts
  • Provides a "panel applet" where you can manage tasks from a dropdown menu
  • Predefined common expressions like: every minute, every week, tomorrow, next week A calendar allows you to choose the day you want a task executed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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