2 * Copyright (C) 2012 Red Hat Inc.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 (* Everything in (* ... *) is a comment.
21 Everything in << ... >> is a shell script. Use >\\> to escape >> in script.
23 This is just a quick start. For full documentation read the
24 whenjobs(1) man page by typing 'man 1 whenjobs'
26 Use 'every <period> : << >>' to run a shell script periodically
27 (like cron). Don't forget the colon!
31 # Get free blocks in /home
32 free=`stat -f -c %b /home`
33 # Set the variable 'free_space'
34 whenjobs --set --type int free_space=$free
37 Use 'when <expr> : << >>' runs the shell script only when
38 the expression is true. 'changes' is a function that monitors
39 a variable and returns true when it changes value.
41 when changes free_space && free_space < 100000 :
43 mail -s \"ALERT: only $free_space blocks left on /home\" $LOGNAME </dev/null