Any way to tell .profile.bashrc that script is already running? The Next CEO of Stack OverflowGet the source directory of a Bash script from within the script itselfHow do I prompt for Yes/No/Cancel input in a Linux shell script?How to add a progress bar to a shell script?Can a shell script set environment variables of the calling shell?How to check if a program exists from a Bash script?How do I tell if a regular file does not exist in Bash?YYYY-MM-DD format date in shell scriptWhat is the cleanest way to ssh and run multiple commands in Bash?Check existence of input argument in a Bash shell scriptSuppress warning messages using mysql from within Terminal, but password written in bash script

pgfplots: How to draw a tangent graph below two others?

How does a dynamic QR code work?

Why do we say “un seul M” and not “une seule M” even though M is a “consonne”?

Could a dragon use its wings to swim?

Raspberry pi 3 B with Ubuntu 18.04 server arm64: what pi version

What steps are necessary to read a Modern SSD in Medieval Europe?

How can the PCs determine if an item is a phylactery?

Is it possible to make a 9x9 table fit within the default margins?

MT "will strike" & LXX "will watch carefully" (Gen 3:15)?

What does this strange code stamp on my passport mean?

Finitely generated matrix groups whose eigenvalues are all algebraic

Avoiding the "not like other girls" trope?

What happens if you break a law in another country outside of that country?

Is it a bad idea to plug the other end of ESD strap to wall ground?

Does Germany produce more waste than the US?

Why did early computer designers eschew integers?

Why doesn't Shulchan Aruch include the laws of destroying fruit trees?

How exploitable/balanced is this homebrew spell: Spell Permanency?

Ising model simulation

Small nick on power cord from an electric alarm clock, and copper wiring exposed but intact

How should I connect my cat5 cable to connectors having an orange-green line?

How can a day be of 24 hours?

Creating a script with console commands

Gauss' Posthumous Publications?



Any way to tell .profile.bashrc that script is already running?



The Next CEO of Stack OverflowGet the source directory of a Bash script from within the script itselfHow do I prompt for Yes/No/Cancel input in a Linux shell script?How to add a progress bar to a shell script?Can a shell script set environment variables of the calling shell?How to check if a program exists from a Bash script?How do I tell if a regular file does not exist in Bash?YYYY-MM-DD format date in shell scriptWhat is the cleanest way to ssh and run multiple commands in Bash?Check existence of input argument in a Bash shell scriptSuppress warning messages using mysql from within Terminal, but password written in bash script










0















I was wondering if there is any argument that I can add to my bash script so it won't be executed again on log on, because it' already executed on reboot. That causes the script to stop, when runned second time.



Bash:




if [ "$BASH" ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
fi

mesg n || true

cd /root/Boti/Gianni/
bash /root/Boti/Gianni/comanda.sh


I am using Debian 9 on a VPS.










share|improve this question






















  • Does your /tmp directory get cleared on reboot? What do you want to do if the script has exited and you run it again?

    – jhnc
    Mar 21 at 21:28












  • It is running in the background with nohup. I just want bash to recognize that it's already running and not execute it everytime I log on.

    – Dalac
    Mar 21 at 21:32











  • So you don't care if it dies unexpectedly for some reason? You'll just wait until the next reboot to restart it? (Not rhetorical. It changes the answer.) And does your /tmp directory get cleaned on reboot?

    – jhnc
    Mar 21 at 21:44











  • The VPS has an 99,98% uptime. I'm not worried for that. And yes, my /tmp it's empty after every reboot.

    – Dalac
    Mar 21 at 23:28












  • I was asking about comanda.sh dying, not the VPS being unreliable. mkdir /tmp/comanda.lock || exit at start of comanda.sh guarantes only one invocation per boot or until the directory is deleted by some other means. Can probably use /run/lock/comanda.lock instead.

    – jhnc
    Mar 21 at 23:41















0















I was wondering if there is any argument that I can add to my bash script so it won't be executed again on log on, because it' already executed on reboot. That causes the script to stop, when runned second time.



Bash:




if [ "$BASH" ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
fi

mesg n || true

cd /root/Boti/Gianni/
bash /root/Boti/Gianni/comanda.sh


I am using Debian 9 on a VPS.










share|improve this question






















  • Does your /tmp directory get cleared on reboot? What do you want to do if the script has exited and you run it again?

    – jhnc
    Mar 21 at 21:28












  • It is running in the background with nohup. I just want bash to recognize that it's already running and not execute it everytime I log on.

    – Dalac
    Mar 21 at 21:32











  • So you don't care if it dies unexpectedly for some reason? You'll just wait until the next reboot to restart it? (Not rhetorical. It changes the answer.) And does your /tmp directory get cleaned on reboot?

    – jhnc
    Mar 21 at 21:44











  • The VPS has an 99,98% uptime. I'm not worried for that. And yes, my /tmp it's empty after every reboot.

    – Dalac
    Mar 21 at 23:28












  • I was asking about comanda.sh dying, not the VPS being unreliable. mkdir /tmp/comanda.lock || exit at start of comanda.sh guarantes only one invocation per boot or until the directory is deleted by some other means. Can probably use /run/lock/comanda.lock instead.

    – jhnc
    Mar 21 at 23:41













0












0








0








I was wondering if there is any argument that I can add to my bash script so it won't be executed again on log on, because it' already executed on reboot. That causes the script to stop, when runned second time.



Bash:




if [ "$BASH" ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
fi

mesg n || true

cd /root/Boti/Gianni/
bash /root/Boti/Gianni/comanda.sh


I am using Debian 9 on a VPS.










share|improve this question














I was wondering if there is any argument that I can add to my bash script so it won't be executed again on log on, because it' already executed on reboot. That causes the script to stop, when runned second time.



Bash:




if [ "$BASH" ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
fi

mesg n || true

cd /root/Boti/Gianni/
bash /root/Boti/Gianni/comanda.sh


I am using Debian 9 on a VPS.







bash






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 21 at 19:59









DalacDalac

33




33












  • Does your /tmp directory get cleared on reboot? What do you want to do if the script has exited and you run it again?

    – jhnc
    Mar 21 at 21:28












  • It is running in the background with nohup. I just want bash to recognize that it's already running and not execute it everytime I log on.

    – Dalac
    Mar 21 at 21:32











  • So you don't care if it dies unexpectedly for some reason? You'll just wait until the next reboot to restart it? (Not rhetorical. It changes the answer.) And does your /tmp directory get cleaned on reboot?

    – jhnc
    Mar 21 at 21:44











  • The VPS has an 99,98% uptime. I'm not worried for that. And yes, my /tmp it's empty after every reboot.

    – Dalac
    Mar 21 at 23:28












  • I was asking about comanda.sh dying, not the VPS being unreliable. mkdir /tmp/comanda.lock || exit at start of comanda.sh guarantes only one invocation per boot or until the directory is deleted by some other means. Can probably use /run/lock/comanda.lock instead.

    – jhnc
    Mar 21 at 23:41

















  • Does your /tmp directory get cleared on reboot? What do you want to do if the script has exited and you run it again?

    – jhnc
    Mar 21 at 21:28












  • It is running in the background with nohup. I just want bash to recognize that it's already running and not execute it everytime I log on.

    – Dalac
    Mar 21 at 21:32











  • So you don't care if it dies unexpectedly for some reason? You'll just wait until the next reboot to restart it? (Not rhetorical. It changes the answer.) And does your /tmp directory get cleaned on reboot?

    – jhnc
    Mar 21 at 21:44











  • The VPS has an 99,98% uptime. I'm not worried for that. And yes, my /tmp it's empty after every reboot.

    – Dalac
    Mar 21 at 23:28












  • I was asking about comanda.sh dying, not the VPS being unreliable. mkdir /tmp/comanda.lock || exit at start of comanda.sh guarantes only one invocation per boot or until the directory is deleted by some other means. Can probably use /run/lock/comanda.lock instead.

    – jhnc
    Mar 21 at 23:41
















Does your /tmp directory get cleared on reboot? What do you want to do if the script has exited and you run it again?

– jhnc
Mar 21 at 21:28






Does your /tmp directory get cleared on reboot? What do you want to do if the script has exited and you run it again?

– jhnc
Mar 21 at 21:28














It is running in the background with nohup. I just want bash to recognize that it's already running and not execute it everytime I log on.

– Dalac
Mar 21 at 21:32





It is running in the background with nohup. I just want bash to recognize that it's already running and not execute it everytime I log on.

– Dalac
Mar 21 at 21:32













So you don't care if it dies unexpectedly for some reason? You'll just wait until the next reboot to restart it? (Not rhetorical. It changes the answer.) And does your /tmp directory get cleaned on reboot?

– jhnc
Mar 21 at 21:44





So you don't care if it dies unexpectedly for some reason? You'll just wait until the next reboot to restart it? (Not rhetorical. It changes the answer.) And does your /tmp directory get cleaned on reboot?

– jhnc
Mar 21 at 21:44













The VPS has an 99,98% uptime. I'm not worried for that. And yes, my /tmp it's empty after every reboot.

– Dalac
Mar 21 at 23:28






The VPS has an 99,98% uptime. I'm not worried for that. And yes, my /tmp it's empty after every reboot.

– Dalac
Mar 21 at 23:28














I was asking about comanda.sh dying, not the VPS being unreliable. mkdir /tmp/comanda.lock || exit at start of comanda.sh guarantes only one invocation per boot or until the directory is deleted by some other means. Can probably use /run/lock/comanda.lock instead.

– jhnc
Mar 21 at 23:41





I was asking about comanda.sh dying, not the VPS being unreliable. mkdir /tmp/comanda.lock || exit at start of comanda.sh guarantes only one invocation per boot or until the directory is deleted by some other means. Can probably use /run/lock/comanda.lock instead.

– jhnc
Mar 21 at 23:41












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55288396%2fany-way-to-tell-profile-bashrc-that-script-is-already-running%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55288396%2fany-way-to-tell-profile-bashrc-that-script-is-already-running%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript