github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/dashboard/config/freebsd/syz-ci-service.sh (about) 1 #!/bin/sh 2 # Copyright 2019 syzkaller project authors. All rights reserved. 3 # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. 4 5 # To use: 6 # - place this script to /usr/local/etc/rc.d/syz_ci 7 # - chmod a+x /usr/local/etc/rc.d/syz_ci 8 # - add the following to /etc/rc.conf (uncommented): 9 # 10 # fsck_y_enable="YES" 11 # syz_ci_enable="YES" 12 # syz_ci_chdir="/syzkaller" 13 # syz_ci_flags="-config config-freebsd.ci" 14 # syz_ci_log="/syzkaller/syz-ci.log" 15 # syz_ci_path="/syzkaller/syz-ci" 16 # 17 # Then syz-ci will start after boot, to manually start/stop: 18 # service syz_ci stop 19 # service syz_ci start 20 21 # PROVIDE: syz_ci 22 # REQUIRE: LOGIN 23 24 . /etc/rc.subr 25 26 command="${syz_ci_path}" 27 name="syz_ci" 28 pidfile="/var/run/${name}.pid" 29 rcvar="syz_ci_enable" 30 start_cmd="syz_ci_start" 31 stop_cmd="syz_ci_stop" 32 33 # syz-ci needs to be able to find the go executable. 34 PATH=${PATH}:/usr/local/bin 35 36 syz_ci_start() 37 { 38 cd "${syz_ci_chdir}" 39 daemon -f -o "${syz_ci_log}" -p ${pidfile} "${syz_ci_path}" ${syz_ci_flags} 40 } 41 42 syz_ci_stop() 43 { 44 local _pid 45 46 _pid=$(cat ${pidfile}) 47 kill -INT $_pid 48 [ $? -eq 0 ] || return 1 49 pwait -t 120s $_pid 50 } 51 52 load_rc_config $name 53 run_rc_command "$1"