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
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
add a comment |
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
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 withnohup
. 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 aboutcomanda.sh
dying, not the VPS being unreliable.mkdir /tmp/comanda.lock || exit
at start ofcomanda.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
add a comment |
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
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
bash
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 withnohup
. 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 aboutcomanda.sh
dying, not the VPS being unreliable.mkdir /tmp/comanda.lock || exit
at start ofcomanda.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
add a comment |
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 withnohup
. 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 aboutcomanda.sh
dying, not the VPS being unreliable.mkdir /tmp/comanda.lock || exit
at start ofcomanda.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
add a comment |
0
active
oldest
votes
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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 ofcomanda.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