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 nohup)
{
The script should echo that the script should be run using ksh (ie, foreground) and exit.
}
Else
{
The script should run fine.
}
Please help. Thanks in advance.
RRVARMA
---------- Post updated at 06:59 PM ---------- Previous update was at 05:55 PM ----------
I tried giving something like this.. the script name is nohup_ksh_testing.sh..
i ran this as
>> ksh nohup_ksh_testing.sh
I got the result as
I tried to run the same script using nohup as
>> nohup nohup_ksh_testing.sh > testing.log &
I got the result as
Neither of the case got the script to echo the second text ie,
echo "This Process is currently running in foreground.";
I have a need to run any number of identical scripts simultaneously, so I've created a driver script which reads a template script, edits these appropriately and then submits them via nohup. The spawned scripts all check to see at some point how many of their number are running and once the count... (7 Replies)
Hi All,
I am facing issue in running a process in nohup. I ran a process in terminal since it is taking too long to complete I need to make it as background and nohup. I tried below and was able to make it in back ground
1. Cntrl + Z
2. bg
I am using Korn Shell so disown is not working... (5 Replies)
I have a long running ksh script that I need to run with "nohup" in the backgound which is all well and good but at the very start of the script it needes to output to the screen to query the user and accept a response before continuing.
Any thoughts on how to accomplish this other than... (11 Replies)
Hello,
I have a process a.out that runs from /a and /b
How can I get the pid of the one running from /a
ps -C /a/a.out
does not work
Thanks! (4 Replies)
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)
Hi, unixers, I'm doing something like
find -type f -name '*.gif' | xargs rm &
find -type f -user root | xargs chown idealo &
wait
#do more stuff
on a very large dir. I'm thinking this would be more efficient if it was running as a single process that did one thing for the first condition,... (1 Reply)
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)