Ask Your Question

Trouble making init.d script on Fedora 26

asked 2017-09-16 13:58:10 -0500

Sol33t303 gravatar image

I have been trying to get my script to run on boot but it won't, I have made the file executable. What am I doing wrong? Here is the code.

# Shadowsocksserver Shadows socks server
# chkconfig: 2345 99 01
# description: This script autostarts my Shadow Socks server
# processname: 1834
. /etc/init.d/functions
start() {
     sudo ssserver -c /etc/shadowsocks.json -d start


stop() {
    sudo ssserver -c /etc/shadowsocks.json -d stop

case "$1" in

This is my first time trying to make a init.d script. The script is meant to start my shadow socks proxy.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-09-16 19:07:18 -0500

aeperezt gravatar image

Fedora 26 use systemd, systemd use different way to load services than init.d, you should follow systemd standard this should be a good reading to lear and do Read This

Using systemd you script should be something like this:


ExecStart=ssserver -c /etc/shadowsocks.json
ExecStop=ssserver -c /etc/shadowsocks.json -d stop


That is to give you and idea of how simple is creating a service on systemd, you may need to add the path to access ssserver and if it need to run as specific user add that in the script. Hope this help good luck.

edit flag offensive delete link more


Thanks for the help, here is the new code

Description=Autostarts my Shadowsocks proxy server

ExecStart=/usr/bin/ssserver -c /etc/shadowsocks.json
ExecStop=ssserver -c /etc/shadowsocks.json -d stop


I have also made it executable, however, it doesn't look like it's working. Here is the output of systemctl status Shadowsocksserver.service: I had to use a link because I reached the character limit.

Sol33t303 gravatar imageSol33t303 ( 2017-09-17 01:50:22 -0500 )edit

Guess you need to select a different socket port, a port not already being used

socket.error: [Errno 98] Address already in use
villykruse gravatar imagevillykruse ( 2017-09-17 08:07:40 -0500 )edit

I've edited it again and here is the new code and output:

Description=Autostarts my Shadowsocks proxy server

ExecStart="/home/Sol33t303/bin/Shadowsocks server"
ExecStop="/home/Sol33t303/bin/Shadowsocks server stop"


It looked like doing this resulted in less errors It looks like I'm running into permission problems right now, which doesn't make sense because I'm using root.

Sol33t303 gravatar imageSol33t303 ( 2017-09-17 15:48:24 -0500 )edit

Look like you need to set some SeLinux rules to make it work as service, try using it with selinux as permissive.

aeperezt gravatar imageaeperezt ( 2017-09-17 21:36:06 -0500 )edit

Question Tools

1 follower


Asked: 2017-09-16 13:58:10 -0500

Seen: 462 times

Last updated: Sep 16 '17