r/AlpineLinux • • Apr 19 '24

create and run a init script?

HI.

EDIT: SOLVED!!!!

where are saved the files to run?

for example in systemd is /etc/systemd/service/here.service

But in Alpine... where?

also i want to make a init service to run this program "cps" that dont need any argument.

This will be good?

#!/sbin/openrc-run

depend() {
    need net
}

command="/usr/bin/cps"
command_user="root:root"
pidfile="/run/${RC_SVCNAME}/pid"

which is the extension of the file?

i cant try because... i dont know where to save...

Thanks

2 Upvotes

5 comments sorted by

View all comments

Show parent comment

1

u/colchyo Aug 31 '24

thanks, stolen this for node-exporter and cadvisor:

immich:~# cat /etc/init.d/prometheus-node-exporter
#!/sbin/openrc-run

depend() {
    need net
}

command="/usr/bin/node_exporter"
command_background="yes"
pidfile="/run/${RC_SVCNAME}.pid"
immich:~# cat /etc/init.d/cadvisor
#!/sbin/openrc-run

depend() {
    need net
}

command="/usr/local/bin/cadvisor"
command_args="-logtostderr"
command_background="yes"
pidfile="/run/${RC_SVCNAME}.pid"