Adding a custom service to rc-service

2 posts / 0 new
Last post
#1 Tue, 2015-07-28 18:14
thepyper
  • thepyper's picture
  • Offline
  • Last seen: 2 years 8 months ago
  • Joined: 2013-09-19

Hi!

I've installed alpine linux 3.2.2 on a raspberry pi 2.
What I want to do is getting my executable (located in /root/csys/acs2/actc) being executed on startup.
How should I do that?
On other distributions I could change /etc/inittab to launch my program (or my startup script) instead of the login executable.
On alpine linux, I think I should add a service, and configure it to be launched at "default" runlevel with rc-service, is it correct?

To configure that, I tried creating a file in "/etc/runlevels/default" named "actc", with the following:

#!/sbin/openrc-run
 
depend() {
	after sshd
}
 
start() {
	/root/csys/acs2/actc
}
 
stop() {
	killall actc
}

That is pretty minimal, but is that supposed to work?
Am I missing something more?

If I try "rc-service actc" it says "service actc does not exist", then I guess I AM definitively missing something :)

Any suggestions? Any docs?
Thanks!

Davide

Sat, 2015-08-15 18:11
shafire
  • shafire's picture
  • Offline
  • Last seen: 2 years 7 months ago
  • Joined: 2013-08-06

Move the actc openrc-script to /etc/init.d and check permissions.
To add it to the default runlevel, use "rc-update add actc".

You could also try

#!/sbin/openrc-run
 
name="actc"
command="/root/csys/acs2/${name}"
#command_background="yes"
 
depend() {
	after sshd
}

Log in or register to post comments