Sergei Trofimovich
7185e242ff
rc-logger.c: fix crash on fclose(NULL) ( #137 )
...
Only close the log if we successfully opened it.
Reported-by: Brian Evans <grknight@gentoo.org>
Tested-by: Brian Evans <grknight@gentoo.org>
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2017-05-30 03:47:55 -04:00
William Hubbs
1ece16bfcd
openrc-shutdown: add dry-run option
2017-05-22 12:42:37 -05:00
William Hubbs
0cfd0dd9ef
openrc-shutdown: move to single user mode by default
...
To be more compatible with sysvinit, move to single user mode if no
options are specified on the command line.
2017-05-22 12:15:15 -05:00
William Hubbs
a77ee2e941
init: add ability to switch to single user mode
2017-05-22 11:29:23 -05:00
William Hubbs
49b8a573a1
add kill_all helper
...
This is similar to the sysvinit killall5 utility. It should only be used
in service scripts, so it will not be installed in the path.
This closes #129 .
2017-05-19 18:13:39 -05:00
William Hubbs
a2055af900
rc_status: calculate time differences in time_t and display seconds in uptime
2017-05-15 18:55:47 -05:00
William Hubbs
cbf96967f1
supervise-daemon: save start time and respawn count before dropping privs
2017-05-12 17:15:55 -05:00
William Hubbs
82e12e3092
rc-status: show uptimes and respawn counts for supervised daemons
2017-05-11 21:39:03 -05:00
William Hubbs
1ebef0d7a3
fix to_time_t to honor dst
2017-05-11 18:13:13 -05:00
William Hubbs
6b4050ab9c
fix from_time_t function
2017-05-11 16:22:12 -05:00
William Hubbs
cf5e9aa2bb
Move time_t conversions to rc-misc.c so they can be shared
2017-05-11 16:06:12 -05:00
William Hubbs
a3250e77d4
supervise-daemon: save start time and respawn count
...
This will allow rc-status to display an uptime and restart count for
supervised processes.
2017-05-11 13:54:20 -05:00
William Hubbs
df027ca472
supervise-daemon: fix our status when we give up on the child process
2017-05-11 11:36:42 -05:00
William Hubbs
4c89e3f5fa
supervise-daemon:create multiple options from --respawn-limit
...
This creates --respawn-delay, --respawn-max and --respawn-period. It was
suggested that it would be easier to follow if the options were
separated.
This is for #126 .
2017-05-10 18:13:23 -05:00
William Hubbs
3673040722
supervise-daemon: add a --respawn-limit option
...
Allow limiting the number of times supervise-daemon will attempt to respawn a
daemon once it has died to prevent infinite respawning. Also, set a
reasonable default limit (10 times in a 5 second period).
This is for issue #126 .
2017-05-09 18:30:08 -05:00
William Hubbs
96c8ba2fb5
supervise-daemon: mark all open file descriptors FD_CLOEXEC
2017-04-29 13:48:45 -05:00
William Hubbs
47cf1d0c70
supervise-daemon:remove the controlling tty in the supervisor
2017-04-29 12:04:15 -05:00
William Hubbs
06a6a27e44
supervise-daemon: fix access to tty_fd and devnull_fd
...
Both the child and supervisor need access to these file descriptors.
2017-04-29 10:12:16 -05:00
William Hubbs
5de3798afc
supervise-daemon: mark the service started when the supervisor is active
2017-04-29 09:41:07 -05:00
William Hubbs
0e3f872098
init: send term/kill signals as final step of shutdown
2017-04-17 12:23:45 -05:00
William Hubbs
4694900190
init: fix signal handling
...
The only signals we handle are SIGINT and SIGCHLD, so block all others
and unblock them in the child process before we start a rurnlevel.
2017-04-13 12:54:30 -05:00
William Hubbs
05738bfce1
init: add re-exec capability
...
This will allow the re-execution of the init process after upgrading
OpenRC.
2017-04-12 17:56:36 -05:00
William Hubbs
cc51bdca3b
Add attribution to openrc-init.c and openrc-shutdown.c
2017-04-07 07:39:12 -05:00
William Hubbs
13ca79856e
add init process
...
openrc-init.c and openrc-shutdown.c are based on code which was written by
James Hammons <jlhamm@acm.org>, so I would like to publically
thank him for his work.
2017-04-06 17:13:59 -05:00
Austin English
9eb669591e
start-stop-daemon: warn if calling --start with --retry or --stop with --wait
...
This fixes #122
2017-04-03 10:43:40 -05:00
William Hubbs
6f614cd3f3
Move deptree2dot to the support folder
...
Since deptree2dot and the perl requirement are completely optional, we
can move this tool to the support folder. This gives the user the option
of using it if they have perl installed, and means we do not have an
optional runtime dependency on perl.
Documentation for this tool has also been added to the support folder.
X-Gentoo-Bug: 600742
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=600742
2017-02-17 12:06:03 -06:00
Doug Freed
6dcb692986
start-stop-daemon: allow all standard signals
...
Also we define the signalpair_item macro.
This fixes #113 .
X-Gentoo-Bug: 604986
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=604986
2017-01-25 17:48:52 -06:00
William Hubbs
b73941f0c3
mountinfo: make the path to /proc/mounts a constant
...
This path should not be hard coded in the open call.
Linux prior to 2.4.19 did not have /proc/self/mounts, so for now I'm
making this value /proc/mounts everywhere, but that may change to
/proc/self/mounts on linux; I'm not sure we should care about <2.4.19.
X-Gentoo-Bug: 604646
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=604646
2017-01-04 18:18:37 -06:00
Benda Xu
c304522131
Clean up warnings that can use the _unused macro
...
X-Gentoo-Bug: 604666
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=604666
2017-01-04 17:18:35 -06:00
Benda Xu
92325b44ba
Indentation fixes
...
X-Gentoo-Bug: 604666
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=604666
2017-01-04 16:59:38 -06:00
Doug Freed
45aa36cc62
librc: detect loops in stacked runlevels and abort
...
This fixes #109 .
X-Gentoo-Bug: 558700
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=558700
2016-12-19 18:24:31 -06:00
Jason Zaman
6414c3bc39
selinux: fix SIGSEGV with invalid contexts
...
Fixes: https://github.com/openrc/openrc/issues/104
2016-11-17 12:03:12 -06:00
William Hubbs
be06cd250e
src/rc/rc: do not try to start services if fork fails
2016-11-01 17:31:57 -05:00
William Hubbs
4fd144c0a6
src/rc/rc-misc.c: report error if call to flock() fails
...
X-Gentoo-Bug: 597390
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=597390
2016-10-24 12:47:49 -05:00
Sven Wegener
78146b0e14
do_service: Initialize idx to 0
...
If index is not explicitly specified for service_started_daemon, it will
look for daemons by random index.
This fixes #100 .
2016-10-11 10:30:02 -05:00
Doug Freed
6710316a18
openrc-run: fix double free
2016-09-30 17:29:56 -04:00
William Hubbs
83bb827edf
Revert "Disable parallel startup in interactive mode"
...
This reverts commit 8b4fc05ff2
.
The original commit did not explain why this feature was disabled, and I
now have a request to enable it.
This fixes #24 .
2016-09-19 12:09:05 -05:00
Doug Freed
6cabaf274d
rc-misc: allow EINFO_VERBOSE through too
2016-09-16 09:51:03 -04:00
Doug Freed
1edb5f6fd9
rc-misc: Allow EINFO_COLOR through env_filter()
...
This allows rc-service -C <service> <action> to properly not print color
messages.
Fixes #93
2016-09-14 22:48:56 -04:00
William Hubbs
69ac78d76a
openrc-run: make runscript warning respect quiet option
...
X-Gentoo-Bug: 591414
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=591414
2016-08-25 11:04:48 -05:00
William Hubbs
ca8c29ee60
librc: fix Docker auto detection
...
The original auto detection of Docker containers assumed the presence of
a container environment variable. However, Docker-1.12 does not
implement this, and I'm not sure which versions of docker implemented
it.
The new test is for the presence of a file named .dockerenv in the
root directory.
2016-07-31 12:24:56 -05:00
Kenneth Lakin
94b98430cb
start-stop-daemon: Add SSD_IONICELEVEL
...
This is the disk IO counterpart to SSD_NICELEVEL.
Modified by William Hubbs to add the variable to the start-stop-daemon
man page.
This fixes #69 .
2016-07-26 12:30:39 -05:00
Doug Freed
3adb8fb389
rc-logger: refuse to cat TMPLOG into itself
...
This prevents an infinite loop in case somebody decides to set
rc_log_path to match TMPLOG.
2016-07-24 02:27:53 +00:00
William Hubbs
695be59083
rc-status: add -m/--manual option to show manually started services
...
X-Gentoo-Bug: 585906
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=585906
2016-07-18 13:20:56 -05:00
Doug Freed
c962678dd6
rc: Rename some static variables to kill warnings
2016-07-16 20:10:37 +00:00
William Hubbs
3a1262703f
Remove the DEBUG_MEMORY macro
...
This fixes #43 .
2016-07-14 16:52:57 -05:00
William Hubbs
20035210bd
make variable aflag a boolean show_all
2016-07-14 12:13:17 -05:00
Jaromil
7f84b5d741
libeinfo: document the x suffix on function names
...
This fixes #88 .
2016-07-13 17:04:28 -05:00
William Hubbs
b2c92b88cc
fstabinfo/mountinfo: ensure /etc/fstab exists before calling setmntent
...
This is based on a patch by A. Wilcox <awilfox.gentoo@foxkit.us>.
X-Gentoo-Bug: 478226
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=478226
X-Gentoo-Bug: 478226
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=478226
2016-06-10 17:16:37 -05:00
William Hubbs
87884db667
Make deprecation warnings for rc and runscript more visible
...
These warnings were inserted in verbose only mode in OpenRC-0.13.A
Now, we are making them more visible in preparation for removing these
compatibility binaries in the future.
2016-05-24 11:24:10 -05:00