How to set automatic run?


 
Thread Tools Search this Thread
Operating Systems Solaris How to set automatic run?
# 8  
Old 04-05-2012
crontab setting.

Quote:
Originally Posted by ignitepressure
go to crontab -e
edit the time, date, etc.
example:
0 6 * * * /home/directory/your_script.sh
explanation:
your script will run everyday at exactly 6am in the morning.
just edit the directory by typing pwd (the exact location of your script)
be sure to edit the permission of your file to make cron/scheduled run of your script to work (chmod o+x your_script.sh)
0 6 * * * /home/directory/your_script.sh

0 min, 6 am, every day(1-31),every month(1-12),every weekday(0-6)..
# 9  
Old 04-05-2012
@vipinkumarr89
O/P in post #3 stated that he did not have permissions to use cron.
# 10  
Old 04-09-2012
Hi JSKOBS,
May below solution will help you !

Solution1:
Code:
#!/bin/bash
#script name /home/shirish/myat.sh
# start service atd
# service atd start
# chkconfig atd on

## Tomorrow at 10:10 AM
dt=$(date --date 'tomorrow' +%Y%m%d1010)

## Run my below script
/bin/sh myscript.sh

## Schedule for tomorrow
at -t $dt  -f  /home/shirish/myat.sh

### So when this script run It will schedule tomorrow AT to run it again on tomorrow

# Solution-2 ## Run infinite loop with sleep
Code:
#/bin/bash
# myscr.sh
while :
do
     ## Run my script
     /bin/sh myscript.sh
     ## sleep for 24 hours
     sleep 86400
done

## Run above as # nohup to make available on log-out to
Code:
## Syntax
# nohup myscr.sh &

--Shirish Shukla
This User Gave Thanks to Shirishlnx For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Set script to run during specific times

Hi all, I have this script which sends mail whenever the system is down. It works fine. Normally the system is down from 21 00 to 21 30 from Monday to Saturday and from 21 00 on Sunday to Monday 06 00 for maintenance. So I want the below script to run only when the system is up, i.e outside the... (2 Replies)
Discussion started by: frum
2 Replies

2. Shell Programming and Scripting

Perl: connect to network devices, run set of commands

I am trying to write a script for my own use that will allow me to connect to network devices, then run a set of commands. I start with a list of ips in a text file. Each ip is on its own line. I start with a second file of commands. Each command on one line. for illustration .. the cmd.txt... (2 Replies)
Discussion started by: popeye
2 Replies

3. Shell Programming and Scripting

run a script to set a globle varible?

Hi, My original shell is csh, I don't likw it, so I have to run bash every time after I login, the problem is I have a script like export PLOG=$1, every time I run the script under bash, the PLOG won't be set, I know I can use source to set the PLOG, is there any other way to do it? ... (3 Replies)
Discussion started by: laopi
3 Replies

4. UNIX for Advanced & Expert Users

Where to set the right "Apache" to run after reboot on a RedHat 5 machine ?!

Hi, I'am working on a RedHat server (V5) and having on it 2 Apache instances, but after each reboot i have the wrong one starting so that i have to stop it doing "httpd -k stop" and than launch the right one doing "/etc/init.d/httpd -k start". For more Details, you may see the link i inserted... (4 Replies)
Discussion started by: mehdi1973
4 Replies

5. Shell Programming and Scripting

Need help howto make a script for Set SNOOP run for 5 minutes

Hi all, I want to monitoring my interface every 6 hours where i want to run snoop command to capture all packet through the interface, so i want running snoop then snoop will run for 5 minutes after that snoop stop then will start again after 6 hours than run for 5 minutes again. thereis any... (9 Replies)
Discussion started by: tindasz
9 Replies

6. Shell Programming and Scripting

How to set dialog to run from a command line ?

Hi, finally successfully native compiled dialog. To run I have to change directory to /opt/dialog/bin and run ./dialog So I see I have to set up configuration file and global environment. But how ? I run make install. And another issue is I run dialog connecting via putty terminal... (3 Replies)
Discussion started by: jack2
3 Replies

7. Shell Programming and Scripting

How to run a set of commands through ssh

I need to run a set of commands on a remote machine using ssh. it should also collect output and return status of each command. Can someone help me how to do this? (1 Reply)
Discussion started by: vickylife
1 Replies

8. Shell Programming and Scripting

set schedule to run a script at background while logout

Hi, How can I run a script at 9:00am and 6:00pm everyday? Can I run it at background while I logout my account? Please help!! Many Thanks!! (1 Reply)
Discussion started by: happyv
1 Replies

9. Shell Programming and Scripting

Is it possible..when ftp session disconnect and it can automatic run again?

Hi, Is is possible when ftp script disconnect by remote server and it can restart to tranfer (such as restart in 10 mins, etc)? Please help!!!! (1 Reply)
Discussion started by: happyv
1 Replies

10. UNIX for Advanced & Expert Users

how to set the environment variable at run time

hi, I have one environment variable like path in my system.But in my program i need to change that path .suppose it has a value "config" now i need to chage it as "config1" or something else.i need to use that variable for complete project.It means at first it will use the old path but after... (4 Replies)
Discussion started by: sada@123
4 Replies
Login or Register to Ask a Question