The title might not say much about the issue at hand so let me get straight to the point.
Let's assume I have a casual user who can log in to the system via SSH into a bash shell.
I have a script which starts a daemon process and then sleeps for 20 seconds. If I run the script on SLES11 SP1 or RHEL6 then after the script exits the process is still running.
If I run the script on SLES11 SP3 or RHEL6.3 then after the script exits the process is no longer running.
2 questions:
1) Is there any Linux/Posix API to know if a process has been invoked as a background process?
linux> myprogram &
Can the code for myprogram detect that it has been invoked to run in the background (via &) ?
2) Is there any Linux/Posix API to make a process run in the background even if it has been started as a foreground process? I.E.
how to run a run a shell script in background even if i exit the terminal or logout,
the process end only when i kill with command kill
Hi All,
Currently our application is running on the server having AIX 5.3 OS.
What we intend to do is to run a shell script owned by another user and needs to be run as that particular user.
I was trying to create a shell script using the su command before running the actual script (which will be executed from the new script). The su command always prompt for a password.
I have a restart script that kills a process, starts the process, sleeps for a while, then kills the process again, and so on.
I want to be able to Strg + C the shell script when it's sleeping but still keep the created process around.
I tried this (simplified):
#!/bin/bash
while true; do
kill -SIGTERM $(pgrep foo)
(foo &)
sleep $((5*60*60))
done
However, the PPID of process f
Hi All,
I have problem with a csh script. This script simply search for a certail process id and kill that using simple kill -5 <pid>. Everything is okay untill there is valid process id trapped.
I am beginner to the SHELL SCRIPT and want to Learn SHELL SCRIPT Basics.
This thread should help to all beginners who want to learn SHELL SCRIPT
*** Thanks in advance to those who will contribute on this thread ***
Please guide me and all beginners...
1. Is there any good e-book available? if yes please share links.
2. Where can I try my shell script learning? any online servers available?
3.
Hi Friends,
Iam invoking another shell script to create B2k_session_id from my shell script.It is properly creating B2k_session_id and after creation control is coming out from the script and going to command prompt.The lines which are after the exectrusteduser.com sh.com are not executing..may be B2k create file have exitscript logic..how to continue my shell script execution process with out g