40.14 Including Standard Input Within a cron EntrySince crontab entries must be a single line long, it's hard to include any standard input with them. Sure, you can use commands like: 0 22 * * * echo "It's 10PM; do you know where your children are?" | wall but you can't use "here documents" and other methods of generating multiline input; they intrinsically take several lines.
To solve this problem, cron
allows you to include standard
input directly on the command line.
If the command contains a percent sign ( 30 11 31 12 * /etc/wall%Happy New Year!%Let's make next year great! runs the wall command at 11:30 a.m. on December 31st, using the text: Happy New Year! Let's make next year great!
as standard input.
[If you need a literal percent sign in your entry, for a command like
- from O'Reilly & Associates' Essential System Administration |
|