init.d

Running Apache Archiva standalone in Gentoo?

I have a server running Gentoo 2.6.12 r6 and I want to run Apache Archiva as a standalone server at startup. Does anyone have a working init.d script to accomplish this? Thanks! ...

How do I translate init.d scripts from Ubuntu/Debian Linux to Solaris?

I have several init.d scripts that I'm using to start some daemons. Most of these scripts I've found on the internet and they all use start-stop-daemon. My understanding is that "start-stop-daemon" is a command that is specific to Linux or BSD distros and is not available on Solaris. What is the best way to translate my init.d scripts f...

Best practice to run Linux service as a different user

Services default to starting as root at boot time on my RHEL box. IIRC, the same is true for other Linux distros which use the init scripts in /etc/init.d. What do you think is the best way to instead have the processes run as a (static) user of my choosing? The only method I'd arrived at was to use something like: su my_user -c 'dae...

Better script to restart mysql on Ubuntu 8.04

When I say sudo /etc/init.d/mysql restart on Ubuntu 8.04.2 sometimes there remains a "mysql_safe" process eating 99% of cpu. Making the machine practically inusable. Is there a better way to restart mysql? I thought about writing a script: sudo /etc/init.d/mysql stop sleep 10 sudo killall mysql_safe sudo /etc/init.d/mysql start But t...

Run Qt application on startup as Linux daemon

I've developed a Qt application which contains a TCP server and such. I'm now trying to make Ubuntu packages and let the application automatically start on startup. The application needs to be running even if nobody is logged in, which means a daemon started via a script in /etc/init.d/ I tried simply running the application on start a...

Special considerations for using Python in init.d script?

Are there any special considerations for using Python in an 'init.d' script being run through init? (i.e. booting Ubuntu) From what I understand through googling/testing on Ubuntu, the environment variables provided to an 'init.d' script are scarce and so using "#!/usr/bin/env python" might not work. Anything else? ...

Erlang: daemon 'init.d' script fails to start

I have a python script which manages an Erlang daemon. Everything works fine when used through a shell once the system is initialized. Now, when I included the same script under "/etc/init.d" and with the symlinks properly set in "/etc/rcX.d", the python script still works but my Erlang daemon fails to start and leaves no discernible tr...

Init.d script to start Hudson doesn't run at boot on Ubuntu

Hi. I'm trying to start Hudson on Ubuntu automatically on boot with an init.d script. The script works fine when invoked manually (ie with ./hudson start), and has update-rc.d-generated sym-links in rc2-rc5, but it doesn't start on rebooting. Does anyone know what might be causing it to not work? The script is as follows (the hudson.log ...

init.d script for a mochiweb app

Hi, Anyone has an init.d script for a mochiweb application on ubuntu to share? Thanks ...

Problem getting tomcat to start up on reboot

I'm having trouble getting tomcat to start I followed these instructions to get tomcat / apache2 running: http://www.mogilowski.net/?p=121 ...but tomcat fails to start on reboot. Here's the message from the log: Nov 30, 2009 6:59:53 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 13009 ms Nov 30, 2009 6:59:53 P...

How to sequence init.d scripts under Ubuntu

I have a few servers and other daemons I need to start up in the right sequence. I have created init.d scripts from the skeleton script, and can install them to start in proper sequence using the numbered naming system, but a few issues remain: One server ('serverA') needs to initialize a database connection, and then listen on a s...

Need init.d script for Python application

I have a python based application which works like a feed aggregator and needs to be part of init.d script so that I could control the execution with start/stop/restart options. Also I want the init.d script to be setup as a cron job (I have example here). I found one sample here http://homepage.hispeed.ch/py430/python/daemon (PS. I ...

Executing python script in background in init.d

to interact with my iPhone, i have created a python script that sends and recives data through a socket, the script must be started after emule in order to work, i have thought of something like this: PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/local/bin/amuled WEB=/usr/local/bin/amuleweb NAME=amuled DE...

Start java process at boot and auto-restart on death

I have two requirements for my Java app. If it dies, restart it. If the server reboots, restart it - simple enough. Using the answer here I have a script that will restart when the java application dies. #!/bin/bash until java -Xms256m -Xmx768m -jar MyApp.jar; do echo "MyApp crashed with exit code $?. Respawning... " >" and it...

Linux service and Source for cron job

Hi, I am new to linux and writing a service in C++ which spawns multiple threads and I am starting the service by calling it from init.d, but how should I send the terminate signal to my application from the script , so that my service terminates all the threads and exits. And also where can I find the source code for any linux servic...

How do I manage a Python based daemon on Linux?

I have a working Python based program that I want to run as a daemon. Currently I'm doing it in a very hackish manner of starting it in with screen-d -m name session and killing it with pkill -9 -f name. Eventually I'm doing to have to move this to the better system we use here (thus I'm not willing to modify the program) but in the int...

How can I list files for an init.d script without ruby

I need to convert a init.d script that uses ruby to not use ruby. I can use perl or python or something else, but I can't use ruby. My main problem is figuring out how to dynamically get the list of *.jar files in a directory and separate them with ':'. The rest I could easily do with a bash script. Here is the Ruby code I'm working wit...

fedora 13 init.d script, can't stop

Hi, I wrote init.d script that suppose to run java CLI proccess. The problem is that when i stop it, i get [failed] and the proccess is still running. thanks #!/usr/bin/env bash # # chkconfig: 345 97 03 # # processname: quotes-srv # # # source function library . /etc/rc.d/init.d/functions NAME=quotes-srv start() { echo -n ...

Init.d script hanging

I have an init.d script that looks like: #!/bin/bash # chkconfig 345 85 60 # description: startup script for swapi # processname: swapi LDIR=/var/www/html/private/daemon EXEC=swapi.php PIDF=/var/run/swapi.pid IEXE=/etc/init.d/swapi ### BEGIN INIT INFO # Provides: swapi # Required-Start: $local_fs # Required-Stop: # Default-Start: 3 4 ...

How can I set environment variables in my Linux service for Asterisk even though it doesn't have a real user?

I have created a linux service that runs as a deamon (and gets started from /etc/init.d/X). I need to set some environment variables that can be accessed by the application. Here's the scenario. The application is a bunch of Perl AGI scripts that depend on (and therefore need to run as) asterisk user but asterisk doesn't have a shell. I...