Creating a CronJob Script


 
Thread Tools Search this Thread
Operating Systems Solaris Creating a CronJob Script
# 1  
Old 01-15-2009
Creating a CronJob Script

Hi All,

Good Day.
Anyone can guide me on how to create a cronjob script that run prstat -a and vmstat 10 10 on the certain time of the day and produce a log which will be kept in a specific directory?

I am running on Solaris 10.

Thanks.
# 2  
Old 01-15-2009
Hei Ronny,
The cron job should look like this:

0 8 * * * /export/home/urname/script/logfile.sh > /dev/null 2>&1

And the logfile.sh looks like this:

#!/bin/bash
YEAR=`TZ=Europe/London /usr/bin/date '+%Y'`
MONTH=`TZ=Europe/London /usr/bin/date '+%m'`
DAY=`TZ=Europe/London /usr/bin/date '+%d'`
HOUR=`TZ=Europe/London /usr/bin/date '+%H'`
#MINUTE=Europe/London /usr/bin/date '+%M'

prstat -a > logfile.log-$YEAR-$MONTH-$DAY-$HOUR &
# 3  
Old 01-15-2009
Thanks mehrdad.
Will try this.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Linux script for several cronjob

I have a linux server for my joomla website. I am importing xml feeds (around 200). The component give a tool which list all the cron job commands to automaticaly make the feeds import I don't want to add one by one each cron job. So my idea is to make one cron job which will call a shell... (0 Replies)
Discussion started by: nino59
0 Replies

2. UNIX for Dummies Questions & Answers

Creating cronjob

Guys I am a complete newbie to UNIX and I need some help. My team has taken on support of a very old UNIX box which is running version 2.4.21. I need to create an urgent cronjob to restart the sladp process every sunday at 1am. This is to to provide a temp fix to a production issue. Problem I... (1 Reply)
Discussion started by: strawdogz
1 Replies

3. Shell Programming and Scripting

Shell script with cronjob

Hello All, I have a script which will cd into a directory based on current timestamp. It will then do a grep and search for a condition. It's run on a cron job that runs every 30 minutes. So if it finds a match in 00, it sends out the contents of that grep to an alert and emails out. Now... (3 Replies)
Discussion started by: liketheshell
3 Replies

4. UNIX for Dummies Questions & Answers

Script not running through Cronjob

Hi, I have a .ksh script which updates the database. The script is running fine manually but it is not running through cron.All the file permissions are fine. The script contents are as below: #!/usr/bin/ksh ddate=`date +%Y%m%d` echo $ddate nohup sqlplus crm/crm @db_state_sync.sql >>... (3 Replies)
Discussion started by: shivangi
3 Replies

5. Solaris

Creating Cronjob using .sh file

Hi all, I have created .sh file which contains oracle's export command to export the tables for backup. Also, used crontab for scheduling the above. currently, cronjob is defined manually using crontab -e command from the root user, but want to know how to write a shell script which on... (2 Replies)
Discussion started by: milink
2 Replies

6. UNIX for Dummies Questions & Answers

how to cancel a cronjob if the cronjob still running

hi everyone I'm newbie in this forum hope I can get some help here :) I have a command in crontab that executed every 1 minute sometime this command need more than 1 minute to finish the problem is, the crontab execute this command although it's not finish processing yet and causing the system... (7 Replies)
Discussion started by: 2j4h
7 Replies

7. Shell Programming and Scripting

help needed with creating challenging bash script with creating directories

Hi, Can someone help me with creating a bash shell script. I need to create a script that gets a positive number n as an argument. The script must create n directories in the current directory with names like map_1, map_2 etcetera. Each directory must be contained within its predecessor. So... (7 Replies)
Discussion started by: I-1
7 Replies

8. UNIX for Dummies Questions & Answers

cronjob to run perl script

Hi all Recently i had finished a perl script. When i run manually, the script work fine. But when i wanted to put the script in cron, it didn't get the same output as it run manually. I felt that it only execute the script until certain line then it stop as i see most of the related files didn't... (6 Replies)
Discussion started by: AirWalker83
6 Replies

9. Shell Programming and Scripting

cronjob inside the script

Hiii, can nayone provide me the sample script which can do the following tasks--- I will apperciate if anyone give me their valuable inputs.I guess this is not at all a big task for the experts in the forum so kindly help me out in this. (3 Replies)
Discussion started by: namishtiwari
3 Replies

10. Shell Programming and Scripting

help help cronjob problem with script

hi all, have no experience with cronjob at solaris, i have create script like below: #!/bin/sh DAY=`/export/home/oracle/bin/lastdate | nawk '{print $1}'` /export/home/orahome/bin/sqlplus -s abc/abc<<eof set heading off; set linesize 100; set feedback off; spool... (4 Replies)
Discussion started by: bucci
4 Replies
Login or Register to Ask a Question