I have a couple thinks I like to do every now and then, but that are connected to some things that cannot be determined by the computer directly, like those:

  • Create a backup of some FTP servers.

    The problem is that it takes some time to to this and I'd like to run it only at home, since the passwords are not encrypted.

  • Do a virus scan of all the files that I exchange with other people.

    For this, I would like to avoid doing this on battery, since it consumes so much power.

  • Clean up octave-core files through the file system. This is a simple find command, and could be run at any time really. I got a similar one to remove all the unison files.

  • Compress all git repositories. This takes some times as well and I'd like to run that only when I am not working on programming things right now.

  • Run updatedb, which has do be done as root though.

Cron jobs seem kind of good, but I am not sure whether they would be started when the computer was off during that time, and if they would be done on the next start, it would hog the ressources when I have to do something time critical.

On the Mac, there is the periodic daily weekly monthly command which performs those kind of things.

Is there something I could use for this or should I just create some scripts like maintenance-home.sh, maintenance-monthly.sh and so on?

  • I'm pretty sure that periodic is just an implementation of cron. "The periodic utility is intended to be called by cron(8) to execute shell scripts located in the specified directory" (ibid). So if periodic provided the behavior you wanted before, I don't see any reason why cron wouldn't work now. – adempewolff Sep 17 '12 at 14:46
  • The thing is that cron calls periodic, but you can call periodic yourself. crom does not have this. Basically, I want to say “I have time now, do what you have to do.” and then it will start working. – Martin Ueding Sep 17 '12 at 15:02
  • ah, gotcha. well you could always throw a launcher on your desktop or wherever, (or put a symlink in /usr/bin if you are more of the CLI type) linking to your scripts in their respective cron directories. Thne whenever you have time you could click the launcher or run the symlinked command. – adempewolff Sep 17 '12 at 15:42
  • Calling them manually is what I currently do. Putting them into the cron directories is probably not too good, then the virus scan would just start when I have no time for it. – Martin Ueding Sep 17 '12 at 15:45
  • I'm a little confused. If you don't want them scheduled but also don't want to call them manually, then what exactly are you hoping to be able to do? Is your question just about how to write a shell script that will call them all at once so that you can run them whenever you have time? Or are you hoping for a program that would manage such a script for you? – adempewolff Sep 17 '12 at 15:50

Your Answer

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

Browse other questions tagged or ask your own question.