PDA

View Full Version : Avvio automatico demone


mghis
07-08-2010, 00:22
Ci sono diversi demoni (processi) che voglio eliminare dall'avvio automatico. Col vecchio init bastava modificare /etc/inittab. Ora pensavo di cancellare il file in /etc/init. Per esempio, per togliere dall'avvio automatico vsftpd do'
$ sudo rm /etc/init/vsftpd.conf

Può sembrare una domanda stupida ma col nuovo upstart non sono pratico.

Grazie per ogni aiuto! :)

Ps: ho ubuntu 10.4

sacarde
07-08-2010, 08:13
con quel comando togli solo un file di configurazione


intendi togliere il link in:

/etc/rc...d/<nomeservizio>


oppure:

http://ubuntrucchi.wordpress.com/2008/02/14/mettere-un-programma-in-esecuzione-automatica/

mghis
07-08-2010, 22:27
Il link che hai postato serve solo per le applicazioni di avvio di GNOME.
I vari demoni partono anche se faccio il login dal terminale virtuale.

Ok però il link simbolico del processo da eliminare (smbd) non è in /etc/rcN.d/<processo>
strano perchè si attiva comunque all'avvio...

Però io non penso che quelli siano solo i file di configurazione. Questo è un pezzo della pagina man di init(5)
On startup, the Upstart init(8) daemon reads its job configuration from
the /etc/init directory, and watches for future changes using ino‐
tify(7).

Files in this directory must end in .conf and may also be present in
sub-directories.

Each file defines a single service or task, with the name taken from
its relative path within the directory without the extension. For
example a job defined in /etc/init/rc-sysinit.conf is named rc-sysinit,
while a job defined in /etc/init/net/apache.conf is named net/apache.


tradotto; all'avvio upstart legge i file in /etc/init e accetta futuri cambiamenti tramite inotify(5). I file in /etc/init devono finire in .conf. Possono essere presenti anche delle sotto-directory. Ogni file definisce un singolo servizio, il cui nome è tratto dalla path dentro la directory, non contando l'estensione [.conf]. Per esempio un processo definito con /etc/init/rc-sysinit,conf si chiama rc-sysinit e uno definito con /etc/init/net/apache.conf si chiama net/apache.

Io vorrei togliere uno di questi processi dall'esecuzione all'automatica senza precludere la possibilità di avviarlo successivamente. Come posso fare?


Grazie di ogni risposta! :)

--------------------EDIT-------------------------
Ho cancellato il file /etc/init/processo.conf dopo averne fatto un backup
Il processo non si attiva più all'avvio ma non riesco neppure ad avviarlo dopo. Lo script in /etc/init.d è un link di un'altro script che serve per la compatibilità fra init e upstart e riconduce al file in /etc/init (che ho cancellato).

sacarde
08-08-2010, 08:28
provato a mettere nel .conf


start on startup

start on runlevel [23]
...


preso da: http://upstart.ubuntu.com/getting-started.html

mghis
08-08-2010, 14:02
provato a mettere nel .conf


start on startup

start on runlevel [23]
...


preso da: http://upstart.ubuntu.com/getting-started.html

ho provato. intendevi dire "stop on runlevel [23]" vero? io lo voglio stoppare il demone.

Pare che funzioni ma anche il demone di stampa (cupsd) non si avvia all'accensione, dopo la modifica!

sacarde
08-08-2010, 15:57
non credo che toccando apache.conf abbia influenzato cups.conf


che hai in cups.conf ?

sacarde
08-08-2010, 16:11
ecco i comandi principali di upstart

http://www.linux.com/archive/feature/125977

mghis
09-08-2010, 18:12
Vorrei stoppare smbd (samba), comunque con apache dovrebbe essere uguale.
/etc/init/cupsd.conf non c'è proprio. Ti posto /etc/init.d/cups

#! /bin/sh
### BEGIN INIT INFO
# Provides: cups
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Should-Start: $network avahi
# Should-Stop: $network
# X-Start-Before: samba
# X-Stop-After: samba
# Default-Start: 2 3 4 5
# Default-Stop: 1
# Short-Description: CUPS Printing spooler and server
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/cupsd
NAME=cupsd
PIDFILE=/var/run/cups/$NAME.pid
DESC="Common Unix Printing System"

unset TMPDIR

test -x $DAEMON || exit 0

mkdir -p /var/run/cups/certs

if [ -r /etc/default/cups ]; then
. /etc/default/cups
fi

. /lib/lsb/init-functions

# Get the timezone set.
if [ -z "$TZ" -a -e /etc/timezone ]; then
TZ=`cat /etc/timezone`
export TZ
fi

restart_xprint() {
if [ -n "$success" ] && [ -x /etc/init.d/xprint ]; then
invoke-rc.d xprint force-reload || true
fi
}

coldplug_usb_printers() {
if type udevadm > /dev/null 2>&1 && [ -x /lib/udev/udev-configure-printer ]; then
for printer in `udevadm trigger --verbose --dry-run --subsystem-match=usb \
--attr-match=bInterfaceClass=07 --attr-match=bInterfaceSubClass=01 2>/dev/null || true; \
udevadm trigger --verbose --dry-run --subsystem-match=usb \
--sysname-match='lp[0-9]*' 2>/dev/null || true`; do
/lib/udev/udev-configure-printer add "${printer#/sys}"
done
fi
}

case "$1" in
start)
log_begin_msg "Starting $DESC: $NAME"
chown root:lpadmin /usr/share/ppd/custom 2>/dev/null || true
chmod 3775 /usr/share/ppd/custom 2>/dev/null || true

mkdir -p `dirname "$PIDFILE"`
if [ "$LOAD_LP_MODULE" = "yes" -a -f /usr/lib/cups/backend/parallel \
-a -f /proc/devices -a -f /proc/modules -a -x /sbin/modprobe ]; then
modprobe -q -b lp || true
modprobe -q -b ppdev || true
fi

start-stop-daemon --start --quiet --oknodo --pidfile "$PIDFILE" --exec $DAEMON && success=1

coldplug_usb_printers
log_end_msg $?
restart_xprint
;;
stop)
log_begin_msg "Stopping $DESC: $NAME"
start-stop-daemon --stop --quiet --retry 5 --oknodo --pidfile $PIDFILE --name $NAME && success=1
log_end_msg $?
restart_xprint
;;
reload|force-reload)
log_begin_msg "Reloading $DESC: $NAME"
start-stop-daemon --stop --quiet --pidfile $PIDFILE --name $NAME --signal 1 && success=1
log_end_msg $?
restart_xprint
;;
restart)
log_begin_msg "Restarting $DESC: $NAME"
if start-stop-daemon --stop --quiet --retry 5 --oknodo --pidfile $PIDFILE --name $NAME; then
start-stop-daemon --start --quiet --pidfile "$PIDFILE" --exec $DAEMON && success=1
fi
log_end_msg $?
restart_xprint
;;
status)
echo -n "Status of $DESC: "
if [ ! -r "$PIDFILE" ]; then
echo "$NAME is not running."
exit 3
fi
if read pid < "$PIDFILE" && ps -p "$pid" > /dev/null 2>&1; then
echo "$NAME is running."
exit 0
else
echo "$NAME is not running but $PIDFILE exists."
exit 1
fi
;;
*)
N=/etc/init.d/${0##*/}
echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac

exit 0

sacarde
09-08-2010, 19:45
sudo initctl stop smbd
sudo initctl stop nmbd

non va?


p.s.
cups non lo so

mghis
12-08-2010, 00:25
si (il secondo comando sì, il primo no) però io vorrei che non si attivassero all'accensione del pc...

grazie per ogni ulteriore aiuto :)

sacarde
12-08-2010, 08:18
per rendere persistente la cosa
nei rispettivi job: /etc/init/smbd.conf e nmbd.conf

modifichi da:

stop on runlevel [!2345]

a

stop on runlevel [2345]