LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-30-2016, 03:07 AM   #1
postcd
Member
 
Registered: Oct 2013
Posts: 527

Rep: Reputation: Disabled
How to run bash script so it has speciffic name in the process list?


Hello,

i need to keep running one bash script. And if it gets killed or stoped by any reason, i need to start it again as soon as possible.

I could create cron task to run it and in the script create condition based on ps aux results to see if it already running. If running i will exit the script and do not continue.

But in process list i cant find the script, only sometimes commands it is using.

// update: when run "./scriptname" i cant find, but when run "sh ./scriptname" i can see "sh scriptname" in the process list

Last edited by postcd; 07-30-2016 at 03:57 AM.
 
Old 07-30-2016, 03:48 AM   #2
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Use daemontools to keep it running.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
need bash script to always run under new process group mattmc Programming 2 10-14-2013 05:26 PM
req: Bash Script check if process command is running if not run it >> skate Linux - Software 3 12-17-2012 02:13 AM
How can a program run but not be in the process list? RandomTroll Linux - Software 10 11-01-2012 09:27 PM
[SOLVED] Partial list with ls-l in bash script run in cron but full list run from command line redgshost Linux - General 29 01-16-2011 12:14 PM
My BASH script work perfect when i run it manualy, but not when it run in the crontab roqarg Linux - Newbie 30 05-06-2010 01:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:44 PM.

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