Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Tue May 23, 2017 5:30 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Startup Script
PostPosted: Tue Nov 13, 2012 1:17 pm 
Offline
User avatar

Joined: Fri Nov 10, 2006 4:10 pm
Posts: 1855
Location: Michigan, USA
Using the latest Debian Squeeze. I'm not a Linux expert by any means, so this is really more a of "is this right?" question.

I have a WE application that I want to run on startup, and I understand I create a bash script, make it executable, toss it in the /etc/init.d directory, and use update-rc.d MyScript. Now, if there's an extra step or parameter that should be here, please say so, because I will do exactly what I wrote here.

Where I'm uncertain is if there's supposed to be anything extra in the script, or if this is literally all that's needed:
#!/bin/bash
/usr/bin/myapp/myapp


Sorry if I'm missing something elementary. :?

Thanks!

_________________
Windows 8 x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2012r1.1

Programming Tutorials & Free Projects: http://www.JasonTheAdams.com
"Christianity has not been tried and found wanting; it has been found difficult and not tried." - G.K. Chesterton


Top
 Profile  
 
 Post subject: Re: Startup Script
PostPosted: Wed Nov 14, 2012 11:10 pm 
Offline

Joined: Sat May 26, 2007 11:37 pm
Posts: 52
Location: Tumwater, Wa
Jason_Adams wrote:
Using the latest Debian Squeeze. I'm not a Linux expert by any means, so this is really more a of "is this right?" question.

I have a WE application that I want to run on startup, and I understand I create a bash script, make it executable, toss it in the /etc/init.d directory, and use update-rc.d MyScript. Now, if there's an extra step or parameter that should be here, please say so, because I will do exactly what I wrote here.

Where I'm uncertain is if there's supposed to be anything extra in the script, or if this is literally all that's needed:
#!/bin/bash
/usr/bin/myapp/myapp


Sorry if I'm missing something elementary. :?

Thanks!


A quick look at your script it looks good, and your steps are sound are you able to put your script in a test environment that replicates your production?
are you having a certain problem with your script?

I'm not a nerd with Debian/Linux, my day job forces me to work with Linux variants.

Hope it helps

_________________
• program, n.: A magic spell cast over a computer allowing it to turn one's input into error messages.
tr.v. To engage in a pastime similar to banging one's head against a wall, but with fewer opportunities for reward


Top
 Profile  
 
 Post subject: Re: Startup Script
PostPosted: Thu Nov 15, 2012 10:58 am 
Offline
User avatar

Joined: Fri Nov 10, 2006 4:10 pm
Posts: 1855
Location: Michigan, USA
Nux wrote:
A quick look at your script it looks good, and your steps are sound are you able to put your script in a test environment that replicates your production?
are you having a certain problem with your script?

Honestly I haven't even tired, yet. I was hoping someone would do exactly what you did — look at it can go, "Looks fine." :)

Nux wrote:
I'm not a nerd with Debian/Linux, my day job forces me to work with Linux variants.

Exactly, I'm in the same boat. I don't work with Linux in my own time, but started using it for server purposes back in May. I dabble in it just enough to do what I need to, but not often enough to really retain everything. :P

Thanks for the feedback, Nux!

_________________
Windows 8 x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2012r1.1

Programming Tutorials & Free Projects: http://www.JasonTheAdams.com
"Christianity has not been tried and found wanting; it has been found difficult and not tried." - G.K. Chesterton


Top
 Profile  
 
 Post subject: Re: Startup Script
PostPosted: Thu Nov 15, 2012 1:45 pm 
Offline
User avatar

Joined: Mon Apr 02, 2007 2:08 am
Posts: 1225
Location: San Francisco, CA, USA
The script should work, I don't see any errors in it. It's a little spartan compared to some of the startup scripts I've seen (like this one for a Minecraft server), but that just means it's easier to debug.

_________________
Boredom Software


Top
 Profile  
 
 Post subject: Re: Startup Script
PostPosted: Thu Nov 15, 2012 8:57 pm 
Offline

Joined: Sat May 26, 2007 11:37 pm
Posts: 52
Location: Tumwater, Wa
Nothing wrong with the kiss philosophy
Keep it simple stupid. :) I follow it everyday
Take it easy all ;)

_________________
• program, n.: A magic spell cast over a computer allowing it to turn one's input into error messages.
tr.v. To engage in a pastime similar to banging one's head against a wall, but with fewer opportunities for reward


Top
 Profile  
 
 Post subject: Re: Startup Script
PostPosted: Thu Nov 15, 2012 9:01 pm 
Offline
User avatar

Joined: Mon Apr 02, 2007 2:08 am
Posts: 1225
Location: San Francisco, CA, USA
Over-Engineered By Design® :lol:

_________________
Boredom Software


Top
 Profile  
 
 Post subject: Re: Startup Script
PostPosted: Thu Nov 15, 2012 9:07 pm 
Offline

Joined: Tue Mar 23, 2010 8:44 pm
Posts: 673
A little off topic but do you guys know if startup scripts will still work on OS X Mountain Lion?

Have there been any changes with startup scripts since 10.6?

Does sandboxing effect anything regarding startup scripts?

I have not yet upgraded to ML.


TIA.


Top
 Profile  
 
 Post subject: Re: Startup Script
PostPosted: Fri Nov 16, 2012 2:33 pm 
Offline
User avatar

Joined: Fri Nov 10, 2006 4:10 pm
Posts: 1855
Location: Michigan, USA
charonn0 wrote:
The script should work, I don't see any errors in it. It's a little spartan compared to some of the startup scripts I've seen (like this one for a Minecraft server), but that just means it's easier to debug.

Hahah! I could throw in some more stuff in just to make sure it has something to crash. Shortly, though, I'll be writing a cron bash script for backing up the pg database. I'm sure I'll break something there. :)


Nux wrote:
Nothing wrong with the kiss philosophy
Keep it simple stupid. :) I follow it everyday
Take it easy all ;)

I've generally managed to avoid this philosophy, but sometimes I get sloppy and forget to over complicate my work. ;)


J.Sh3ppard wrote:
A little off topic but do you guys know if startup scripts will still work on OS X Mountain Lion?

Have there been any changes with startup scripts since 10.6?


Not that I mind this being tossed in here, but I do recommend posing the question in the Mac section. I don't know how many of the Mac guys come in here looking to solve Mountain Lion questions. :)

_________________
Windows 8 x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2012r1.1

Programming Tutorials & Free Projects: http://www.JasonTheAdams.com
"Christianity has not been tried and found wanting; it has been found difficult and not tried." - G.K. Chesterton


Top
 Profile  
 
 Post subject: Re: Startup Script
PostPosted: Fri Nov 16, 2012 4:45 pm 
Offline

Joined: Tue Mar 23, 2010 8:44 pm
Posts: 673
Jason_Adams wrote:
Not that I mind this being tossed in here, but I do recommend posing the question in the Mac section. I don't know how many of the Mac guys come in here looking to solve Mountain Lion questions. :)


Yah it was a shot in the dark while walking a tightrope :)

I'll probably ask it in the Mac section later.


Top
 Profile  
 
 Post subject: Re: Startup Script
PostPosted: Fri Nov 16, 2012 5:39 pm 
Offline
User avatar

Joined: Fri Nov 10, 2006 4:10 pm
Posts: 1855
Location: Michigan, USA
For those like me to didn't know, I learned you have to add the LSB tag to the script. This tells the system how to handle your script in run-level detail.

I also added detection to find the file and used one of them fancy constant things:

#!/bin/bash

### BEGIN INIT INFO
# Provides: runwebapplication.sh
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Runs Application Daemon
# Description: Finds and checks the Application permissions, and runs it if it can
### END INIT INFO

file=/usr/bin/appdirectory/app

if [ -x "$FILE" ]; then
echo "Starting Web Application"
"$FILE" &
else
echo "Web Application not found or isn't executable"
fi


I knew I'd figure out a way to complicate this. :D

_________________
Windows 8 x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2012r1.1

Programming Tutorials & Free Projects: http://www.JasonTheAdams.com
"Christianity has not been tried and found wanting; it has been found difficult and not tried." - G.K. Chesterton


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group