The following example is inspired by this link, which actually does not mention all steps and is listed just to credit the source: http://patrakov.blogspot.com/2011/01/writing-systemd-service-files.html
Step 1: I created this file (note location) which essentially fires a bash process with an extended argument. You could fire your own command which could be ...
There are currently 3 main init systems used by linux. A few years ago, there was just one, SysVinit. But SysVinit was seriously lacking in capabilities such as service dependency graphing, so it's been deprecated in most distros by now. Currently most distros are switching to systemd. Though there is also upstart.
But here's the answer to your question for ...
Since Ubuntu has recently switched over to systemd, some services will be listed by upstart.
and others, by systemd
systemctl -l --type service --all
or as root
systemctl -r --type service --all
However software still using the init system will likely be listed in
Looking through all of those will yield most services ...
The problem is service strips all environment variables but TERM, PATH and LANG which is a good thing. If you are executing the script directly nothing removes the environment variables so everything works.
You don't want to rely on external environment variables because at startup the environment variable probably isn't present and your init system ...
Figures that I'd figure this out on my own.
The clue was here, in the user service output:
Dec 23 19:43:27 redmine systemd: Reached target Default.
My unit was asking to be loaded with multi-user.target, but there is no such target in the user systemd.
I changed this to default.target in the unit file, disabled and re-enabled the service, and it now ...
Ubuntu is a systemd system, where the service status command actually calls systemctl status, and systemctl has a --no-pager option that does exactly what you're looking for. So you may be better off using the straight systemctl command in your script.
sudo systemctl --no-pager status supervisor
EDIT: env var SYSTEMD_PAGER
Another way, as pointed out by ...
Wheezy uses SysV init, and all the services are controlled with special shell scripts in /etc/init.d, so ls /etc/init.d will list them. These files also contain a description of the service at the top, and the directory contains a README.
Some but not all of them have a .sh suffix, you should leave that off when using, eg., update-rc.d.
I don't know about raspbian, but since it is derived from Debian, I assume
nohup will be available too. Instead of running a process as,
$ proc &
try to use:
$ nohup proc &
The nohup will prevent the process from being terminated when the terminal disconnects. HTH.
You shouldn't need to restart NFS every time you make a change to /etc/exports. All that's required is to issue the appropriate command after editing the /etc/exports file:
$ exportfs -ra
Excerpt from the official Red Hat documentation titled: 21.7. The /etc/exports Configuration File.
When issued manually, the /usr/sbin/exportfs command allows ...
The notion of daemon is attached to processes, not files. For this reason, there is no sense in "finding daemons on the filesystem". Just to make the notion a little clearer : a program is an executable file (visible in the output of ls) ; a process is an instance of that program (visible in the output of ps).
Now, if we use the information that I gave in ...
Your question was a little lacking in details, so I'm assuming that you mean that you typed the command to start your server on the console of your Pi, and it executed in the foreground.
If this is the case, you have five options, ordered by complexity to implement:
Use @f-tussel's answer. Since you're new to GNU/Linux, the & symbol tells the shell ...
As others have noted, the answer is all about runlevels which are basically the modes of operation of an operating system. On Linux, these are usually:
ID Name Description
0 Halt Shuts down the system.
1 Single-user Mode Mode for administrative tasks.
2 Multi-user Mode ...
Have you tried acpipowerbutton from this command set?
VBoxManage controlvm <uuid>|<name>
Edit after reading the comments:
You can use acpid or other acpi utilities to make it graceful. Also, can you provide ...
less will normally turn its pager mode off if it detects that its
output is not a terminal. So you could try making your command's
output not-a-terminal by running something like:
sudo service supervisor status | cat
If you'd like to reuse your code sample, it could look something like:
case "$1" in
kill `cat /var/run/hit.pid`
if [ -e /var/run/hit.pid ]; then
echo hit.sh is running, pid=`cat /var/...
@jofel's answer was exactly what I needed to get a working setup. POsting this for anyone else stumbling on this question. I needed a way to have capistrano restart my Ruby application after deploying from my local machine. That means I needed passwordless access to restarting systemd services. THIS is what I have and it works wonderfully!
Note: my user and ...
A background-job (ie. started with &) still has it's stdin, stdout and stderr connected to the terminal it was started in. It may suddenly write (eg. error-messages) to the terminal ("disturbing" the job in the foreground) or pause waiting for input from the keyboard (you must first put it in the foreground). You may of course redirect stdout and ...
I believe CentOS 7 and above uses systemd. If that is the case for your system, try the following:
Place the script commands you wish to run in /usr/bin/myscript.
Remember to make the script executable with chmod +x.
Create the following file:
These are runlevels and are a System V-style initiation used by most *NIX systems (with the notable exception of systemd-based systems). When booting the kernel/user decides what runlevel should it run and execute only that runlevel. Meaning that depending the runlevel you can boot up with a different set of programs. There are runlevels for halt and reboot ...
You need to create two files: one for service, other for timer with same name.
after that reload ...
as I mentioned in the comment:
as Wikipedia link mention: In Windows NT operating systems, a Windows service is a computer program that operates in the background. It is similar in concept to a Unix daemon.
A daemon is a type of program on Unix-like operating systems that runs unobtrusively in the background, rather than under the direct control of a ...
Rather than code this up yourself, consider using Vagrant, which is built to instantiate and control virtualbox instances. The documentation is excellent and I suggest that you check it out rather than attempting to roll your own.
The long and short of it is that you create a simple control file and then run vagrant up to start as many VirtualBox instances ...
From man systemctl:
Pager to use when --no-pager is not given; overrides $PAGER.
Setting this to an empty string or the value "cat" is equivalent to
Override the default options passed to less ("FRSXMK").
So, somewhere in your environment initialization, set:...
Nmap’s Ncat can do this, with its -c or -e options:
nc -l -c bc
will listen on the default port (31337) and, when a connection is established, run bc with its standard input and output connected to the socket.
nc localhost 31337
will then connect to a “remote” bc and you can then enter bc expressions and see their result.
socat can do this too (thanks ...
You can use cron if your version has the @reboot feature. From man
Instead of the first five fields, one of eight special strings may appear:
@reboot Run once, at startup.
You can edit a user-local crontab with the command crontab -e without root privileges. Then add the
It seems you are running a system with systemd yet you are using sysV commands. Did you create a sysV init script or a systemd unit file?
State active (exited) means that systemd has successfully run the commands but that it does not know there is a daemon to monitor.
If there is you must define it in the unit file by configuring the Type and ExecStart ...