Launch Program From Within Script

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
BlackVeils

Launch Program From Within Script

Post by BlackVeils »

its simple really, and i tried a few different things, but cant get it to work.

Code: Select all

#!/bin/bash

echo -e "\n\n\n\e[1m\e[94m\e[2m      Deleting History...\n\n\n"

killall SpiderOak

sleep 5

/usr/bin/SpiderOak --purge-historical-versions all

/usr/bin/SpiderOak &

echo -e "\n\n\n\e[1m\e[94m\e[2m      END\n\n\n"
how do i get SpiderOak program to open after history has been deleted, yet still have the last echo, and be able to close terminal window without closing SpiderOak?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
Pilosopong Tasyo
Level 6
Level 6
Posts: 1432
Joined: Mon Jun 22, 2009 3:26 am
Location: Philippines

Re: Launch Program From Within Script

Post by Pilosopong Tasyo »

BlackVeils wrote:...and be able to close terminal window without closing SpiderOak?
nohup or disown should suffice:

Code: Select all

nohup /usr/bin/SpiderOak &

Code: Select all

/usr/bin/SpiderOak &
disown
o Give a man a fish and he will eat for a day. Teach him how to fish and he will eat for a lifetime!
o If an issue has been fixed, please edit your first post and add the word [SOLVED].
BlackVeils

Re: Launch Program From Within Script

Post by BlackVeils »

great in theory. i tried this to test after nohup and disown didnt work:

Code: Select all

/usr/bin/SpiderOak &
disown

sleep 10

echo -e "\n\n\n\e[1m\e[94m\e[2m      END\n\n\n"
when echo runs or its the end of script, spideroak gets closed. without "sleep" (for the sake of testing) spideroak doesnt get a chance to load.
User avatar
bjornmu
Level 3
Level 3
Posts: 189
Joined: Wed Dec 19, 2012 2:50 am
Location: Trondheim, Norway

Re: Launch Program From Within Script

Post by bjornmu »

I would often use something like this (even made a small script that does it):

MyProgram < /dev/null > /dev/null 2>&1 &
BlackVeils

Re: Launch Program From Within Script

Post by BlackVeils »

i did some more testing of this principle, killing and launching a program, i even tried a different program, my music player audacious.

what i have found is that the issue is related to running the script from a terminal. if its run without terminal, everything works, programs can be opened and closed, no problem.

which i find odd, and not having a strategic mind, i dont know how people get around that. in this case i actually dont need the window of feedback, i was being daft.

so i have learned i can launch programs from a script, if the script is not run from a terminal.
Locked

Return to “Scripts & Bash”