LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-03-2022, 12:55 AM   #1
awaismalik
Member
 
Registered: Mar 2021
Posts: 50

Rep: Reputation: Disabled
bash script running in background disappeared


Hi,
I set the script to run in background using
/bin/bash /home/user/script.sh Argument &

the script appeared in ps aux
root 1189438 0.0 0.0 12724 3060 pts/0 S 12:39 0:00 /bin/bash /home/user/script.sh Argument


and now today i dont see the script listed or running anymore in ps aux output while niether PC nor any service was restarted.i dont understand how process got killed or stop ?. how should i look into this.
 
Old 05-03-2022, 01:56 AM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by awaismalik View Post
Hi,
I set the script to run in background using
/bin/bash /home/user/script.sh Argument &

the script appeared in ps aux
root 1189438 0.0 0.0 12724 3060 pts/0 S 12:39 0:00 /bin/bash /home/user/script.sh Argument


and now today i dont see the script listed or running anymore in ps aux output while niether PC nor any service was restarted.i dont understand how process got killed or stop ?. how should i look into this.
Maybe the script terminated.
Would be nice to see the actual script.
 
Old 05-03-2022, 03:57 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,947

Rep: Reputation: 7325Reputation: 7325Reputation: 7325Reputation: 7325Reputation: 7325Reputation: 7325Reputation: 7325Reputation: 7325Reputation: 7325Reputation: 7325Reputation: 7325
you cannot check a process which is already terminated, but you can add some logging to that script to see how does it work (next time).
 
Old 05-03-2022, 05:05 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,751

Rep: Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929
Not enough information. In addition to the above.

Although your script is running in the background it is still attached to its parent process. A common mistake is to close the terminal or if it is a remote connection to close the session. Using nohup or using screen will detach the process.
 
1 members found this post helpful.
Old 05-03-2022, 09:32 AM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,695

Rep: Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972
Quote:
Originally Posted by awaismalik View Post
Hi,
I set the script to run in background using
/bin/bash /home/user/script.sh Argument &

the script appeared in ps aux
root 1189438 0.0 0.0 12724 3060 pts/0 S 12:39 0:00 /bin/bash /home/user/script.sh Argument

and now today i dont see the script listed or running anymore in ps aux output while niether PC nor any service was restarted.i dont understand how process got killed or stop ?. how should i look into this.
Unless you started it with "nohup", as soon as you closed that terminal window, that script closed. So if you rebooted your PC (or even just logged out), it's gone. As said, you're not showing us the script or giving us any details.
 
  


Reply

Tags
script, scripts



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to Specify Running Time of a Background Process in a Bash Script julianvb Linux - Software 3 01-05-2016 12:50 PM
Why has the background disappeared in Firefox ? goody211 Linux - Newbie 2 09-04-2011 01:35 AM
[SOLVED] Desktop background and all icons/files from it disappeared kstera Linux - Desktop 12 01-19-2010 10:55 AM
Bash script hangs upon starting another script in the background masea2 Linux - Software 4 11-13-2006 05:18 AM
Gnome 2.6 and Slackware 10: Desktop icons disappeared and background has to be reset towarzysz Slackware 5 07-20-2005 11:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration