Running backend processes in ssh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Running backend processes in ssh
# 1  
Old 10-11-2013
Running backend processes in ssh

Hi Team,
i have a script alloc.sh on server1
Code:
main () {
if [ "$1" == "REQUEST" ] ; then
    (nohup ./alloc.sh ALLOCATE 5400 isogen_alloc_$2 < /dev/null 2> /dev/null &)
    echo ALLOC_OK
    exit 0
fi
if [ "$1" == "ALLOCATE" ] ; then
    sleep $2
fi
}
main $@

Here if i execute the alloc.sh on server1, it gets executed successfully.
purpose of this script is to run a process in background for 5400 seconds for monitoring reservation of server1 for some purpose.

But the problem here is, if i execute the same script from server2(where passwordless to server1 is enabled),

Code:
On Server2:
ssh root@server1 './alloc.sh REQUEST ABC_123456'
ALLOC_OK
<it'll come out after the sleep time>

the script is not going for background.!

Could you pls check why the command (nohup ./alloc.sh ALLOCATE 5400 isogen_alloc_$2 < /dev/null 2> /dev/null &) is not working as expected when i call this from server2.

Regards,
Chandana
# 2  
Old 10-11-2013
Run your script like that.

Code:
Method 1:

nohup yourscript.sh &

Method 2:
- start the process from console
- send it to background CTRL + Z
- then disown -a

This User Gave Thanks to learnbash For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Many processes running at the same time

Hello everybody , I launched cron to execute a task every hour but the job takes more than hour that's why I'm getting more than 1000 cron processes running at the same time !!! My question is how to tell cron not to execute unless the job terminated in order to have only one process running .... (14 Replies)
Discussion started by: beautymind
14 Replies

2. Shell Programming and Scripting

Check Running Processes

I want to check how many processes are running with same names and get their respective counts. ps -ef|grep -Eo 'process1|process2|process3| '|sort -u | awk '{print $2": "$1}' Output would look like : $ ps -ef|grep -Eo 'process1|process2|process3| '|sort | uniq -c | awk '{print $2":... (8 Replies)
Discussion started by: simpltyansh
8 Replies

3. Solaris

Sendmail processes not running

Hi All! I am trying to get sendmail to work but unsuccessfull...when I run ps -ef | grep sendmail root 10578 10561 0 11:01:24 pts/1 0:00 grep sendmail I do not see its processes When I run the following commands: bash-3.00# svcs sendmail svcs: Pattern 'sendmail' doesn't match... (9 Replies)
Discussion started by: fretagi
9 Replies

4. Linux

Running processes

Hi guys is it normal to have 5-10 cron/syslog processes running... in my case i got 10 cron process running. (4 Replies)
Discussion started by: batas
4 Replies

5. Solaris

Running processes on GZ/LZ

Hi guys just a question is it normal to see running process on a non-global zone in the global zone... processes such as cron. (3 Replies)
Discussion started by: batas
3 Replies

6. UNIX and Linux Applications

phonon-backend-gstreamer vs phonon-backend-vlc vs phonon-backend-xine

phonon-backend-gstreamer vs phonon-backend-vlc vs phonon-backend-xine What are the advantages and disadvantages of phonon-backend-gstreamer, phonon-backend-vlc, and phonon-backend-xine. I was reading this and got curious. ... (1 Reply)
Discussion started by: cokedude
1 Replies

7. Shell Programming and Scripting

how to know the running processes.

Hi can anybody help me regarding this.. i want know the output of ps -ef with explanation. how can we know the running processess. this is the output of ps -elf F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD 19 T root 0 0 0 0 SY ... (1 Reply)
Discussion started by: rajesh_pola
1 Replies

8. Shell Programming and Scripting

monitoring running processes

I have a script that runs continuously and will deliver a file to multiple servers via scp. On occasions one of the scp's will hang and as a result not complete in sending the remaining files and not loop around again. If I run the scp commands with a & they'll complete, but I want to make sure... (2 Replies)
Discussion started by: nhatch
2 Replies

9. UNIX for Advanced & Expert Users

running processes with no hang up

Can we run a script in nohup which calls another script in nohup. eg Script1.sh #Script1 start nohup script2.sh . . . #end script1.sh Now can I do this nohup script1.sh Also is all scheduled processes (crontab entries) will run as nohup? Would appreciate if any one can... (3 Replies)
Discussion started by: yakyaj
3 Replies

10. Programming

getting certain info for all processes currently running

i am writing a utility that displays information about all the running processes in the /proc directory. I do not know how to get the following information for each of the processes in the /proc directory: -effective user id -effective user name -effective group id -effective group name... (3 Replies)
Discussion started by: Yifan_Guo
3 Replies
Login or Register to Ask a Question