You may know I use cron quite a lot, and you may also say that I love cron. It’s easy and simple to use, but when you just boot up your computer, some cron jobs will have to wait till the next scheduled time to run. If you like me, running cron job for getting updates from various sources, then you would have to manually run those scripts.
run-parts of debianutils is the command for the job, you simply symbolic link every script in a directory and:
$ run-parts /path/to/dir
You can test with --test (only executable) or --list to make sure everything is in place. Running with --verbose or --report (only output when something went wrong) to see the process. You can also pass argument through --arg, pass to all scripts.
Unfortunately, you can only tell run-parts one directory and it doesn’t do recursively.
The following command can do what run-parts can’t:
run-parts-deep() { find -L "$@" -type f -executable -exec {} \; } run-parts-deep dir1 dir2 dir3
This is very simple, don’t have any options, and I don’t actually use it, I stick with run-parts. But if you want a base template to start with. It follows symbolic links, also detects circular loop.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.