How to start a service at startup












0















I am using Ubuntu Server to make a Kodi box. I'm using kodi-standalone-service to do so. I have made a shell script (sudo -S <<< "password" systemctl start kodi) to start kodi. When I run it mannually it starts kodi as expected. I need it to run at startup though. The only way I could do so (or at least I thought) was to add @reboot /home/main/startupscript.sh to crontab.
And I did so. Now Ubuntu stops after the initial boot log whithout any meaningful error message. And I cant use the terminal. Can you guys help me?
Could it be something to do with xorg even though I have it installed? (clearly as I can run it manually) Maybe the command is ran too soon in the boot process?










share|improve this question


















  • 1





    I assume you’ve tried systemctl enable kodi.service

    – Appleoddity
    Jan 5 at 6:07
















0















I am using Ubuntu Server to make a Kodi box. I'm using kodi-standalone-service to do so. I have made a shell script (sudo -S <<< "password" systemctl start kodi) to start kodi. When I run it mannually it starts kodi as expected. I need it to run at startup though. The only way I could do so (or at least I thought) was to add @reboot /home/main/startupscript.sh to crontab.
And I did so. Now Ubuntu stops after the initial boot log whithout any meaningful error message. And I cant use the terminal. Can you guys help me?
Could it be something to do with xorg even though I have it installed? (clearly as I can run it manually) Maybe the command is ran too soon in the boot process?










share|improve this question


















  • 1





    I assume you’ve tried systemctl enable kodi.service

    – Appleoddity
    Jan 5 at 6:07














0












0








0








I am using Ubuntu Server to make a Kodi box. I'm using kodi-standalone-service to do so. I have made a shell script (sudo -S <<< "password" systemctl start kodi) to start kodi. When I run it mannually it starts kodi as expected. I need it to run at startup though. The only way I could do so (or at least I thought) was to add @reboot /home/main/startupscript.sh to crontab.
And I did so. Now Ubuntu stops after the initial boot log whithout any meaningful error message. And I cant use the terminal. Can you guys help me?
Could it be something to do with xorg even though I have it installed? (clearly as I can run it manually) Maybe the command is ran too soon in the boot process?










share|improve this question














I am using Ubuntu Server to make a Kodi box. I'm using kodi-standalone-service to do so. I have made a shell script (sudo -S <<< "password" systemctl start kodi) to start kodi. When I run it mannually it starts kodi as expected. I need it to run at startup though. The only way I could do so (or at least I thought) was to add @reboot /home/main/startupscript.sh to crontab.
And I did so. Now Ubuntu stops after the initial boot log whithout any meaningful error message. And I cant use the terminal. Can you guys help me?
Could it be something to do with xorg even though I have it installed? (clearly as I can run it manually) Maybe the command is ran too soon in the boot process?







linux boot shell-script crontab kodi






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 5 at 5:49









Zizico2Zizico2

31




31








  • 1





    I assume you’ve tried systemctl enable kodi.service

    – Appleoddity
    Jan 5 at 6:07














  • 1





    I assume you’ve tried systemctl enable kodi.service

    – Appleoddity
    Jan 5 at 6:07








1




1





I assume you’ve tried systemctl enable kodi.service

– Appleoddity
Jan 5 at 6:07





I assume you’ve tried systemctl enable kodi.service

– Appleoddity
Jan 5 at 6:07










1 Answer
1






active

oldest

votes


















0














The proper way to start a service during the boot proccess in a system that uses systemd is by using the enable option.



systemctl enable kodi.service


Regards.






share|improve this answer
























  • Oh thank you. I had never used a service before. Should've done a little research xd. I've still got a problem though. I can't exit Kodi. When I do it terminates the X server and stays ok "closing log file.X server" until I reboot... (Power button or shutdown signal as I'm working on a virtual machine). Is it a problem with kodi-standalone-service?

    – Zizico2
    Jan 5 at 11:27











  • I have found a way around it. I can just use another tty. It' still bugging me though...

    – Zizico2
    Jan 5 at 11:40











  • Glad it worked. I haven't used this service, so I don't really know how it works.

    – Manuel Florian
    Jan 5 at 19:53











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1390792%2fhow-to-start-a-service-at-startup%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














The proper way to start a service during the boot proccess in a system that uses systemd is by using the enable option.



systemctl enable kodi.service


Regards.






share|improve this answer
























  • Oh thank you. I had never used a service before. Should've done a little research xd. I've still got a problem though. I can't exit Kodi. When I do it terminates the X server and stays ok "closing log file.X server" until I reboot... (Power button or shutdown signal as I'm working on a virtual machine). Is it a problem with kodi-standalone-service?

    – Zizico2
    Jan 5 at 11:27











  • I have found a way around it. I can just use another tty. It' still bugging me though...

    – Zizico2
    Jan 5 at 11:40











  • Glad it worked. I haven't used this service, so I don't really know how it works.

    – Manuel Florian
    Jan 5 at 19:53
















0














The proper way to start a service during the boot proccess in a system that uses systemd is by using the enable option.



systemctl enable kodi.service


Regards.






share|improve this answer
























  • Oh thank you. I had never used a service before. Should've done a little research xd. I've still got a problem though. I can't exit Kodi. When I do it terminates the X server and stays ok "closing log file.X server" until I reboot... (Power button or shutdown signal as I'm working on a virtual machine). Is it a problem with kodi-standalone-service?

    – Zizico2
    Jan 5 at 11:27











  • I have found a way around it. I can just use another tty. It' still bugging me though...

    – Zizico2
    Jan 5 at 11:40











  • Glad it worked. I haven't used this service, so I don't really know how it works.

    – Manuel Florian
    Jan 5 at 19:53














0












0








0







The proper way to start a service during the boot proccess in a system that uses systemd is by using the enable option.



systemctl enable kodi.service


Regards.






share|improve this answer













The proper way to start a service during the boot proccess in a system that uses systemd is by using the enable option.



systemctl enable kodi.service


Regards.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 5 at 6:15









Manuel FlorianManuel Florian

1595




1595













  • Oh thank you. I had never used a service before. Should've done a little research xd. I've still got a problem though. I can't exit Kodi. When I do it terminates the X server and stays ok "closing log file.X server" until I reboot... (Power button or shutdown signal as I'm working on a virtual machine). Is it a problem with kodi-standalone-service?

    – Zizico2
    Jan 5 at 11:27











  • I have found a way around it. I can just use another tty. It' still bugging me though...

    – Zizico2
    Jan 5 at 11:40











  • Glad it worked. I haven't used this service, so I don't really know how it works.

    – Manuel Florian
    Jan 5 at 19:53



















  • Oh thank you. I had never used a service before. Should've done a little research xd. I've still got a problem though. I can't exit Kodi. When I do it terminates the X server and stays ok "closing log file.X server" until I reboot... (Power button or shutdown signal as I'm working on a virtual machine). Is it a problem with kodi-standalone-service?

    – Zizico2
    Jan 5 at 11:27











  • I have found a way around it. I can just use another tty. It' still bugging me though...

    – Zizico2
    Jan 5 at 11:40











  • Glad it worked. I haven't used this service, so I don't really know how it works.

    – Manuel Florian
    Jan 5 at 19:53

















Oh thank you. I had never used a service before. Should've done a little research xd. I've still got a problem though. I can't exit Kodi. When I do it terminates the X server and stays ok "closing log file.X server" until I reboot... (Power button or shutdown signal as I'm working on a virtual machine). Is it a problem with kodi-standalone-service?

– Zizico2
Jan 5 at 11:27





Oh thank you. I had never used a service before. Should've done a little research xd. I've still got a problem though. I can't exit Kodi. When I do it terminates the X server and stays ok "closing log file.X server" until I reboot... (Power button or shutdown signal as I'm working on a virtual machine). Is it a problem with kodi-standalone-service?

– Zizico2
Jan 5 at 11:27













I have found a way around it. I can just use another tty. It' still bugging me though...

– Zizico2
Jan 5 at 11:40





I have found a way around it. I can just use another tty. It' still bugging me though...

– Zizico2
Jan 5 at 11:40













Glad it worked. I haven't used this service, so I don't really know how it works.

– Manuel Florian
Jan 5 at 19:53





Glad it worked. I haven't used this service, so I don't really know how it works.

– Manuel Florian
Jan 5 at 19:53


















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1390792%2fhow-to-start-a-service-at-startup%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

Mangá

Eduardo VII do Reino Unido