LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-28-2018, 08:40 PM   #1
eco_bach
Member
 
Registered: Dec 2016
Posts: 242

Rep: Reputation: Disabled
Auto run a bash script on startup [ubuntu]


Ok so I've done some googling and tried one suggestion which hasn't worked

I've done a chmod 777 to the script.sh file

And then created a crontab with a @reboot command
Code:
@reboot /home/foo/02_Scripts/script.sh
as mentioned in this tutorial
https://www.youtube.com/watch?v=2ZQViUv0-zs

Anyone have a solution that does work?
 
Old 09-28-2018, 09:02 PM   #2
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
how to for systemd which I think your distro is using

How to automatically execute shell script at startup boot on systemd Linux

skip the cron, and put it in the start up area like ..rc.d/ use to be but systemd don't got that anymore, I assume.

Last edited by BW-userx; 09-28-2018 at 09:07 PM.
 
Old 09-28-2018, 09:10 PM   #3
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
This looks like a good place to start.

https://linuxtechlab.com/executing-c...pts-at-reboot/
 
Old 09-29-2018, 03:28 AM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
what sort of script?
does it work manually?
user script or system script?
if system, use a systemd service.
if user, use your DE's startup applications (aka autostart).
 
  


Reply

Tags
autorun, bash



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to auto run script in startup struggled_newbie Linux - Newbie 2 03-13-2011 10:31 PM
My Linux Bash Script Fails to run when automated with OS Startup sanitynotvanity Linux - Software 5 06-16-2009 10:50 AM
how to run a bash script before startup alirezan1 Linux - Newbie 3 01-14-2009 09:51 PM
auto run bash script when logged in linuxmandrake Fedora 1 06-11-2005 08:22 PM
Getting firewall script to auto-run at startup lrt2003 Linux - Newbie 2 04-25-2004 02:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration