Run script at startup [Solved]

Discussion in general that pertains to Sabayon Linux - Must Pertain to Sabayon Linux

Moderator: Moderators

Run script at startup [Solved]

Postby shadowlab » Thu Aug 29, 2013 14:43

I recently installed Sabayon 13.08 MATE64 and I'm attempting to extend the longevity of my SSD by moving my ~/.cache to RAM storage. I created the symlink and then added a tmpfs entry in /etc/fstab. The last step I imagine is to automatically create a new /tmp/cache directory every time I boot up since the old one will be destroyed each time I shut down.

I tried adding commands to /etc/rc.local, which did not work. I then tried creating a .start script in /etc/local.d/, and it too was unsuccessful. Any suggestions?

Thanks, Kevin.
Last edited by shadowlab on Thu Aug 29, 2013 17:31, edited 1 time in total.
Laptop: Sony SVE14A290X
Specs: 8GB RAM and 250GB Samsung 840 EVO SSD
OS: dual-boot Sabayon 13.08 MATE64 and Windows 8
shadowlab
Baby Hen
 
Posts: 6
Joined: Thu Aug 29, 2013 1:13

Re: Run script at startup

Postby belcocco » Thu Aug 29, 2013 16:38

If you are using systemd, rc.local might be ignored completely.
Edit a file script.sh with your command:
#!/bin/bash
<your_command>

Create a service unit something.service in /etc/systemd/system/.
Edit with:
[Unit]
Description=Script name

[Service]
ExecStart=/path/to/script.sh

[Install]
WantedBy=multi-user.target


Tell systemd to start the script on boot with:
# systemctl enable something.service.

Ciao
belcocco
Old Dear Hen
 
Posts: 452
Joined: Sat Nov 29, 2008 18:53
Location: Milan, Italy

Re: Run script at startup

Postby shadowlab » Thu Aug 29, 2013 17:30

That did the trick. Thank you belcocco!
Laptop: Sony SVE14A290X
Specs: 8GB RAM and 250GB Samsung 840 EVO SSD
OS: dual-boot Sabayon 13.08 MATE64 and Windows 8
shadowlab
Baby Hen
 
Posts: 6
Joined: Thu Aug 29, 2013 1:13

Re: Run script at startup [Solved]

Postby fjkhf » Tue Oct 29, 2013 14:22

Hello , I am continuing this thread because I tried the above in order to run a script at start up but it didn't work.

Any ideas ?

Thanks!
fjkhf
Simple Hen
 
Posts: 97
Joined: Tue Jun 26, 2012 13:41

Re: Run script at startup [Solved]

Postby linuxfluesterer » Tue Oct 29, 2013 19:05

There is a directory, where you can place your scripts to be executed. It is:
Code: Select all
/etc/local.d

Here you can place scripts to be executed at start time, which must have extension .start and scripts to be executed at shutdown time also. Those must have the extension .stop.
The other point is to be sure, that the needed service is enabled at boot time. You do this as root with:
Code: Select all
systemctl enable local-d.service

I'm not sure, but it may be possible, that this service is already activated by default.
I have made my scripts run sucessfully in /etc/local.d, no other one.

-Linuxfluesterer (I love KDE ...)
I really hope, that by the Brexit (poor Britain), TTIP will be finally prevented. But don't get tired to talk to your local politician to open eyes for danger to democracy because of TTIP
User avatar
linuxfluesterer
Old Dear Hen
 
Posts: 704
Joined: Thu Sep 20, 2012 19:47
Location: Germany

Re: Run script at startup [Solved]

Postby fjkhf » Wed Oct 30, 2013 9:10

Hello , unfortunately it didn't work either.

I am using a script

Code: Select all
#!/bin/bash
~/.dropbox-dist/dropboxd


which I named dropbox.start and placed it in /etc/local.d

Any ideas?
Thanks!
fjkhf
Simple Hen
 
Posts: 97
Joined: Tue Jun 26, 2012 13:41

Re: Run script at startup [Solved]

Postby linuxfluesterer » Wed Oct 30, 2013 11:56

I think, the problem is your home directory (~), which is not known at boot time. And so, dropboxd is too early.
In KDE I have activated dropbox daemon (dropboxd) as 'autostart', when login. This works, because it is my home directory. So, in Mate, do you have a settings window, where you can 'autostart' dropboxd then, just after login?
I don't know Mate, sorry. Maybe you could change your script to /home/fjkhf/.dropbox-dist/dropboxd.
If this works, you won't need 'autostart' when login.

-Linuxfluesterer (I love KDE ...)
I really hope, that by the Brexit (poor Britain), TTIP will be finally prevented. But don't get tired to talk to your local politician to open eyes for danger to democracy because of TTIP
User avatar
linuxfluesterer
Old Dear Hen
 
Posts: 704
Joined: Thu Sep 20, 2012 19:47
Location: Germany

Re: Run script at startup [Solved]

Postby fjkhf » Wed Oct 30, 2013 22:14

Unfortunately it doesn't work either..

I am using KDE.It is not only for dropbox but generally I want to know.
fjkhf
Simple Hen
 
Posts: 97
Joined: Tue Jun 26, 2012 13:41

Re: Run script at startup [Solved]

Postby linuxfluesterer » Wed Oct 30, 2013 22:52

To help you especially in case with Dropbox, I have a link for you:
http://www.nixternal.com/kde-and-dropbox/
But attention, pls! There is one mistake in that description (picture). Don't select dropbox, select dropboxd (the script file).
I have just downloaded the package from that website and installed it. I can ensure, it works. I told you, I have used Dropbox before.
And: I can also ensure you, if you put !executable! scripts in /etc/local.d with .start extension, they will be executed at boot time. Check and try again, pls.

-Linuxfluesterer (I love KDE ...)
I really hope, that by the Brexit (poor Britain), TTIP will be finally prevented. But don't get tired to talk to your local politician to open eyes for danger to democracy because of TTIP
User avatar
linuxfluesterer
Old Dear Hen
 
Posts: 704
Joined: Thu Sep 20, 2012 19:47
Location: Germany

Re: Run script at startup [Solved]

Postby fjkhf » Fri Nov 01, 2013 13:09

Hello and thanks for helping.

I did it through system settings -> auto start and it works but now the icon of dropbox doesn't appear in the panel.

The .start didn't work unfotunately.


---EDIT-------------

I restarted and now the icon is ok!
fjkhf
Simple Hen
 
Posts: 97
Joined: Tue Jun 26, 2012 13:41


Return to Sabayon Linux General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest