20

I created an upstart script in Ubuntu, thinking it would be the same for Debian. But Debian doesn't have a /etc/init folder that Ubuntu has. I went to the upstart download page and seeing that they have packages, did a apt-get install upstart, but it asks to remove sysvinit, which I know will/might screw up my system. So how do I make my Ubuntu script work on Debian?

tshepang
  • 65,642
theTuxRacer
  • 1,063

2 Answers2

13

It's not directly about Debian vs Ubuntu, it's about SysVinit vs Upstart. Debian defaults to SysVinit; you can install Upstart, but you need to know what you're doing, and you should be familiar with it before you even think of installing it on a production server. Although it's theoretically possible to install both, with only one of them running as process number 1, Debian doesn't support this out the box.

Upstart is younger than SysVinit and has more capabilities, which explains why you can't just take an Upstart service description and feed it to SysVinit. You'll have to write a script for /etc/init.d. Basically that script needs to look at its first argument ($1) and start, stop or restart the service as directed.

If you were using Upstart events to determine when to start the script, you'll have to use some other methods. Upstart gathers events from many different sources; you can get the trigger from wherever Upstart gets it, Upstart in this respect is just a convenient way of not having to look for triggers in many different places and protocols.

5

The reason it's going to remove sysvinit is because these two are conflicts. Also, note that sysvinit is considered essential (read: not to be removed, unless you know what you are doing).

Part of the output from 'aptitude show upstart`:

Conflicts: startup-tasks, system-services, sysvinit, upstart-compat-sysv, upstart-job

If you can afford to hose your system, go ahead and install it.

tshepang
  • 65,642
  • No, its a production server. Is there no way I can create a service that I can start and stop from the terminal? – theTuxRacer Jan 18 '11 at 14:51
  • Then put your script into /etc/init.d and make it understand the minimum of start|stop|restart commands. You don't need upstart to run the script, only your usual command line. – alex Jan 18 '11 at 14:56
  • @kau How about you clone your production server to some testing machine and install upstart, and test? – tshepang Jan 18 '11 at 20:17
  • @alex @Tshepang Can you take a look and advise, please? http://paste.ubuntu.com/555683/ The jar isnt executed. – theTuxRacer Jan 19 '11 at 08:31
  • You don't need exec there -- go read some manpages and/or books about shell scripting. – alex Jan 19 '11 at 11:22