Skip to content

Instantly share code, notes, and snippets.

@dsh0005
Created October 9, 2021 00:04
Show Gist options
  • Save dsh0005/ec3d1de3a2a60b28acd3013f169a43ba to your computer and use it in GitHub Desktop.
Save dsh0005/ec3d1de3a2a60b28acd3013f169a43ba to your computer and use it in GitHub Desktop.
Custom pcscd rc file to enforce memory limits
#!/bin/sh
# PROVIDE: pcscd
# REQUIRE: LOGIN
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# pcscd_enable="YES"
. /etc/rc.subr
name="pcscd"
rcvar=pcscd_enable
command="/usr/local/sbin/pcscd"
pcscd_ulimit(){
#echo "Setting ulimit for pcscd."
/usr/bin/limits -B -m 128m -v 256m /usr/local/sbin/pcscd
}
start_cmd="pcscd_ulimit"
load_rc_config "$name"
: ${pcscd_enable="NO"}
run_rc_command "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment