The firewall runs on FreeBSD; a simple script like this from a forum on the internet should work on the firewall. I guess I'm saying: search the 'net for shell scripting examples to get some more help also. By default, when users are created on the firewall, their SHELL variable is set to tcsh, which is an enhanced version of csh (so, any tcsh or csh shellscripts you find on the web should work [there are some caveats to that statement, but in general they should work]).
Crontab is stored in the 'cf database'; you can run cf cron q to output all the cron jobs. Running cf cron q will help you see how the current cron jobs look so you can figure out how to make your own. Do a man cf_crontab to learn how the command works. If you're not familiar with the cf command you can read this blog post I wrote about it.
The firewall includes the mail command. You can use that command to send email off the box. Do a man mail or search the internet to learn how it works.
This simple script below writes out system information to a file. It writes out some static information first and then does a loop, writing the rest of the commands out to a file every 180 seconds (it appends the information to the file actually, using the >> shell command):
/usr/bin/vmstat -sm >>system.info.txt
while [ 1 ]
echo "=================================" >> system.info.txt
/usr/bin/top -u -s 20 -b -d 3 -S 20 >> system.info.txt
/usr/bin/netstat -i >> system.info.txt
/usr/bin/netstat -f inet >> system.info.txt
/usr/bin/netstat -m >> system.info.txt
/usr/bin/netstat -s >> system.info.txt
You can save this text as a file on the firewall (like systeminfo.sh) then chmod it to make it executable (chmod 744 systeminfo.sh) and then run it (sh ./systeminfo.sh). You stop it with CTRL+C. The file it outputs is called system.info.txt and it's in the directory you run the command from.
I use the edit command to edit files via the command-line of the firewall. The File Editor in the GUI is also useful for...editing files.
The script was really useful, thanks guys. I did some changes as per my need and it works beautifully.
Is there a way to run this on multiple firewalls from another machine ?