- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: hwo to use cron tab
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-09-2002 09:35 AM
тАО05-09-2002 09:35 AM
hwo to use cron tab
for every 30 minit .
now hwo to to it using n cron tab and swave it in one folder
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-09-2002 10:13 AM
тАО05-09-2002 10:13 AM
Re: hwo to use cron tab
Create script named netstat_output like
#!/bin/sh
cd /home/sachin
day=`date +%d`
host=`uname -n`
netstat -s >> ${host}.${day}
sendmail -s "output of netstat -s" sachin < ${host}.${day}
exit 0
This will create a one file per day.
then first run it from command line to check how does it works.
add that to crontab
#crontab -e
0,30 * * * * * /home/sachin/netstat_output
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-09-2002 12:34 PM
тАО05-09-2002 12:34 PM
Re: hwo to use cron tab
0,30 * * * * netstat -s >> /tmp/netstat.out
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-09-2002 05:43 PM
тАО05-09-2002 05:43 PM
Re: hwo to use cron tab
Just one piece of advice in regards to the use of crontab. Never use the -e option, I've seen on a number of occassions where the crontab file has been lost.
# crontab -l >/tmp/wrk1
Make your changes
# crontab -l /tmp/wrk1
This will ensure your original is always in tact.
Cheers
~Michael~
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-09-2002 10:55 PM
тАО05-09-2002 10:55 PM
Re: hwo to use cron tab
I get cron to back itself up, then you only lose a day's changes at most, should something go wrong:
00 00 * * * /usr/bin/crontab -l > /usr/local/etc/crontab
Rgds, Robin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-09-2002 11:13 PM
тАО05-09-2002 11:13 PM
Re: hwo to use cron tab
First create your script and Second insert it and redirect standard input and Standard error to a log file.
1. First :
Your script will be called *netActivity.sh*, located in /home/userName and will look like the following three lines :
echo "-=> Start log on `hostname` at `date` : "
/usr/bin/netstat -n
echo "-=> End log on `hostname` at `date` : "
2. Second :
Entry in crontab and redirecting standard Input/Output to the log file called *netActivity.log* located in /home/userName, each 30 minutes :
0,30 * * * /home/userName/netActivity.sh > /home/userName/netActivity.log 2>&1
Magdi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-09-2002 11:20 PM
тАО05-09-2002 11:20 PM
Re: hwo to use cron tab
not the answer to the question but an alternative way to do crontab .I simply make a copy of the crontab file and then edit the original with vi then issue crontab crontab_filename.
crontab files are found in /usr/spool/cron/crontabs
cheers
John.