Run process with nohup every certain time


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Run process with nohup every certain time
# 1  
Old 12-22-2009
Run process with nohup every certain time

Hi,

I need execute a script every 30 minutes. As might be done without using cron

Thx.
# 2  
Old 12-22-2009
Can you use the at command?
# 3  
Old 12-22-2009
In principle I think not.
Thx
# 4  
Old 12-22-2009
You will have to write a driver script
Code:
#!/bin/ksh
while true
do
     now=$(date +%M)
     if [[ $now -eq 30 || $now -eq 0 ]]; then
            nohup myscript arg1 arg2 & 2&>1 > log.$(date %m/%d/%y%nTIME:%H:%M:%S)
     fi
     sleep 60
done

# 5  
Old 12-22-2009
Thx.

arg1 arg2 <--- This is obligatory ? the script not use args.
# 6  
Old 12-22-2009
No it is an example. I gather you are new to shell script. You really should get someone to review all the code you wrote BEFORE it goes into production. Or run it in test for a day or two.

The example above creates code that runs forever, so you have to start it from the command line something like this:
Code:
chmod +x myexample.sh       # change permissions so it can excute
./myexample.sh  2>&1 > logfile  &

If it misbehaves you have to read logfile to find errors. You really should find a way to get someone who understands this stuff to create a crontab entry for you. This is not a production quality solution. By any means.
# 7  
Old 12-22-2009
Thx!

I will probe that in a few days.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Nohup apending data each time i run script

I have a problem here. i am running my script in nohup but if i run it 2 or three time , in my output i see it is giving me old data as well, in-spite i delete nohup.out file. i tried to look a lot from where the old data is coming. can some one tell me how the old data is also coming again and... (11 Replies)
Discussion started by: mirwasim
11 Replies

2. UNIX for Dummies Questions & Answers

To run 5 commands at the same time with process from a list

I have many command is list in the variable lists,each command will run a very long time, so I want to run 5 commands at the same time with process till it complete run all the command, lists="aa bb cc dd xx gg blabla zz ......." ( a very long list) can some one point me the codes? ... (7 Replies)
Discussion started by: yanglei_fage
7 Replies

3. UNIX for Advanced & Expert Users

Find the process was run using nohup or ksh.

Hi, I want to write a script which should be run only on foreground. Is there any way that the script can check itself whether it was run using nohup or ksh and if the user runs the script using nohup then it should prompt the user to run it using ksh? If (The user triggers the script using... (4 Replies)
Discussion started by: RRVARMA
4 Replies

4. UNIX for Advanced & Expert Users

nohup and background process

What is the difference between running a process using nohup and running a process in background ? Please explain (6 Replies)
Discussion started by: srksn
6 Replies

5. Programming

kill a process which run out of time

hello everybody!! i want ur help! it is urgent!! ... pid=fork(); if(pid==0) { execl(a program); exit(1);} else if (pid>0) { timer(5); //(command 1)timer is a function that count up to 5sec if(kill(pid,0)==0)kill(pid,9);//(command 2) wait(&status); .... } else perror("error");... (3 Replies)
Discussion started by: nicos
3 Replies

6. Shell Programming and Scripting

how to run multiple process at the same time

Hello guys, Look what im doing: I need to run a process from a SERVER1 to SERVER2, SERVER3 and SERVER4. The shell of the process is in each SERVER (2 to 4) So from SERVER1 i do: for i in SERVER2 SERVER3 SERVER4 do rsh $i ' ./process.sh ' done The problem is: each process.sh... (2 Replies)
Discussion started by: lestat_ecuador
2 Replies

7. Shell Programming and Scripting

pid of nohup process

I want to print the pid of a nohup process to a file so later I can use the list of pid's in that file to stop the background processes again. I use ksh on AIXv5.3: nohup /start/script.ksh 1>/dev/null 2>&1 print $$ > .pid nohup /start/script2.ksh 1>/dev/null 2>&1 print $$ >> .pid But... (2 Replies)
Discussion started by: rein
2 Replies

8. Shell Programming and Scripting

how to run process in certain date and time

hi all! i want to run a process in certain date and hour (like feb 2007 ,hour 3 p.m) how shell i write it my script call cs-update-pr another question :as the script running, will i see it as process ?ho does it run background? and if not - how can i define to him to run background? thanks... (3 Replies)
Discussion started by: naamas03
3 Replies

9. Shell Programming and Scripting

nohup process hangs

Hi All, I tried searching for this, but I have yet to find anything useful. So here goes, if a script executed from another script with nohup & hangs, does it affect the parent script? Reason I ask, we have a windows box with NFS, and we use it to store some of our files. Currently, I mount the... (2 Replies)
Discussion started by: Sully
2 Replies

10. Programming

Process Run time information

Hello, I am working on Sun Solaris 5.7. I am trying to read the running time of a process through a C program. One way I am reading it is by using the command ps -<pid> -f The other way is from the struct psinfo_t which is there under /proc/pid/psinfo. However, the two times are... (1 Reply)
Discussion started by: hmurali
1 Replies
Login or Register to Ask a Question