Autostart services


#1

How can I ensure that services are available on startup, that is when I open my workspace? I upgraded the mysql database to version 5.6, and now it is not available on startup. For some projects, I might also need other background services, like rsyslog. It seems not enough to configure them with sysv.


#2

#3

Hm, that did not help. Just adding

sudo service rsyslog start

to ~/.profile broke the workspace. It did not start again, and also cloning failed afterwards. Fortunately, I have a backup clone :slight_smile:

Do you have any clue what goes wrong, and how to fix - or debug - the problem?


#4

Ah, I got it working! Adding

&

after the command in the .profile file did the trick. Now the workspaces come up as they should, again. And all services are available right from startup! Here is the script, it might be useful for others as well:

function checkstart {
        service=$1

        if [[ ! $(ps -ef | grep -v grep | grep "$service" | wc -l) > 0 ]]
        then
                sudo service $service start &
        fi
}

checkstart redis-server
checkstart mysql
checkstart rsyslog