Run a command on boot
You'd need to add the command that you would run, on /etc/rc.local
.
Note: That path may be dependent on your distribution or init system, so check with the distributions documentation to make sure (ie it could be /etc/init.d/local
or such).
One would typically
Again, depending on your distribution and init system, you may need to add the file as a service on the default runlevel (or the appropriate runlevel)
sudo update-rc.d local defaults 80 # ie for ubuntu
Look at this howto for Ubuntu,
or look here for Archlinux,
or here for Gentoo
Remote part ?
The remote part has lots of trouble. What do you mean by remote ? Is the machine that runs the daemon in a Lan ? do you trust your lan ? does it communicate to the Internet ? etc
I would probably set up ssh
on that machine, and whenever needed, I would log in and start/stop the daemon. You'd only need to set up sshd
(typically /etc/ssh/sshd_config
) and add ssh
to run on boot.
If the machine is on a local Lan, and you believe that logging in and manually starting/stopping the daemon is too boring and want something more automated, I would probably write up a bot that would parse the mailbox for a specific user and upon receival of "special" mail, it would start or stop or toggle the status of the daemon (note it must have the appropriate permissions). That sounds easy, but you need to trust your lan or be careful on how you parse the mail (mail spoofing etc).