
FreeBSD - creating a simple rc.d service
created services before, this is much easier than systemd.
this is all it takes to create a small service that mounts and unmounts a nfs partition.
yes I could put this into fstab.. but I found it can hang the computer on boot if it is not present.. and there is no easy way to 'turn it off' in the fstab without physically editing it.
it only requires one file, a rc.d style service file.
this makes things easier, i can not simply say.. as root
service zengarden start
service zengarden stop
and add this to my rc.conf
zengarden_enable="YES"
here is the file that does all the work.
/usr/local/etc/rc.d/zengarden
#!/bin/sh
# PROVIDE: zengarden
# REQUIRE: serenity nfs-client
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable the zengarden:
#
# zengarden_enable="YES"
#
. /etc/rc.subr
#export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
name="zengarden"
rcvar="zengarden_enable"
start_cmd="${name}_start"
stop_cmd="${name}_stop"
zengarden_start()
{
/sbin/mount serenity:/srv/nfs/zg /mnt/zg
}
zengarden_stop()
{
umount /mnt/zg
}
load_rc_config $name
: ${zengarden_enable=NO}
run_rc_command "$1"
using search/replace all of 'zengarden' in this file .. you can create a simple rc.d service that works for you. (be sure you name the file you create the same)
edit the command within start/stop respectively to get the results you want.
Leave FreeBSD - creating a simple rc.d service to:
Read more #admin posts
Best Posts From marcDouglas
We have not curated any of klevn's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From marcDouglas
- 5G will be piloted in Wuhan
- ammonia powered car? apparently it is possible, has zero emissions, but nobody wants to help make it happen
- A gui for youtube-dl, written in TCL/TK 8.6 - and a small script to compile source into one file.
- LCD helps curation rewards. TCL library created to retrieve api.hive.blog values
- find Current Voting Power with some tcl code to interact with the api.hive.blog
- FreeBSD - creating a simple rc.d service
- BME280 sensor (temp,humidity, pressure) - NetBSD - RasberryPi 2 - enabling GPIO - gpioiic --- ( .. not yet .. the project has staled )
- play encrypted DVDs in FreeBSD (libdvdcss libdvdread libdvdnav)
- (zfs single user primer) dual booting with a ZFS volume floating between them
- so patriot's front .. is fed driven NOT COOL GUYS.. not cool .. you are suppose to help us not set us up to fight each other