Tiny Core Linux

Tiny Core Extensions => TCE Talk => Topic started by: wwwronin on December 09, 2015, 01:07:50 AM

Title: How to start program automatically after system started
Post by: wwwronin on December 09, 2015, 01:07:50 AM
How to start program automatically after system started .
And how to load drivers(like video card) automatically.
Title: Re: How to start program automatically after system started
Post by: bmarkus on December 09, 2015, 01:50:10 AM
How to start program automatically after system started .

Start in /opt/bootlocal.sh
Title: Re: How to start program automatically after system started
Post by: nitram on December 09, 2015, 01:57:19 AM
Hi wwwronin.

bmarkus beat me but this may provide additional information. If i'm wrong, someone will correct and i'll learn too.

Drivers should be listed in onboot.lst, example xf86-video-intel.tcz.

/opt/bootlocal.sh for programs and commands at boot, especially requiring root, example:
Code: [Select]
#!/bin/sh
# put other system startup commands here

sudo /usr/local/sbin/basic-firewall noprompt
mkdir /mnt/nfs_test
/usr/local/etc/init.d/nfs-server start
/usr/local/etc/init.d/nfs-client start

Plain text document in ~/X.d./ for user/non-root items, example non-executable plain text document named startups containing:
Code: [Select]
amixer set Master 80% &
amixer set PCM 100% &
amixer set Master unmute &
amixer set PCM unmute &
conky &
xset s 300 &
Title: Re: How to start program automatically after system started
Post by: wwwronin on December 09, 2015, 03:07:07 AM
That means I should rewrite /opt/bootlocal.sh in tinycore.gz?
Title: Re: How to start program automatically after system started
Post by: Misalf on December 09, 2015, 03:24:48 AM
/opt/bootlocal.sh  already runs as root. No  sudo  required.

/opt/bootlocal.sh  is by default added to the backup on system shutdown / reboot.

http://tinycorelinux.net/corebook.pdf
Title: Re: How to start program automatically after system started
Post by: wwwronin on December 09, 2015, 03:43:37 AM
I read the cookbook , if I want to start X-Window based program , the startup script must be placed at ~/.X.d .I try to start editor program when system is loaded, that takes effect. But  it seems that we must change the permission of files put in dir ~/.X.d . Is this correct ?
Title: Re: How to start program automatically after system started
Post by: Juanito on December 09, 2015, 04:00:14 AM
The permissions should be tc:staff
Title: Re: How to start program automatically after system started
Post by: nitram on December 09, 2015, 05:16:27 AM
Thanks Misalf, noticed my sudo entry after the fact, remnant of newbier days :)

wwwronin file(s) in ~/.X.d. are NOT scripts, just plain text files named whatever. You can have multiple entries in a single file. Or create multiple files with a single entry in each file. The permissions are of course tc:staff, provided you're running as tc, as it's in your home directory. You do NOT need to  chmod +x  or anything, it's NOT a script.

So you could do...

filename: ~/.X.d./10_editor
entry: editor &

filename: ~/.X.d./20_firefox
entry: firefox &

....or just one simple file named ~/.X.d./startups containing:

editor &
firefox &
Title: Re: How to start program automatically after system started
Post by: wwwronin on December 09, 2015, 05:56:47 AM
Thanks a lot
Title: Re: How to start program automatically after system started
Post by: wwwronin on December 09, 2015, 06:49:26 AM
 I use command like this "editor &" ,when system is started ,there a  two editor windows .  Why is that?