Run a Script After Start Up - Deepin
Tofloor
poster avatar
xolotl
deepin
2016-06-09 18:15
Author
(This continues on from my ALSA problem https://bbs.deepin.org/post/31030)

I've spent a lot of time looking at a lot of answers and documentation to try and work out how to get a script to run on (or after) start up. These all have some assumed knowledge and I'm assuming that each method I try doesn't work due to my own fault.

Could I please have the steps necessary to run "amixer -c 0 set PCM 150" and "amixer -c 0 cset name='IEC958 Playback Switch' on" after boot? (I say after to make sure my script isn't actually working then reverted by something else). Every boot at the moment I open up a terminal and run it manually.

Many thanks

Reply Favorite View the author
All Replies
arlas
deepin
2016-06-09 22:03
#1
just add it to the end of ~/.bashrc


btw enter nano ~/.bashrc  in the terminal
Reply View the author
xolotl
deepin
2016-06-09 22:20
#2
At the end of ~/.bashrc I have put
  1. #ALSA fix

  2. amixer -c 0 set PCM 150

  3. amixer -c 0 cset name='IEC958 Playback Switch' on

Copy the Code

I also tried a 'sleep 5' above it to make it wait. Still no sound until I type those commands manually. This makes no sense. What could it be?
Reply View the author
laoguang
deepin
2016-06-10 02:15
#3
dude, try rc.local.

My mac's trackpad got some issues with kernel 4.4, i need to manually modprobe the driver, I put the code in rc.local above exit 0 and it worked.

just saying, may be you need root to execute the amixer command, so put sudo in front and try again.
Reply View the author
laoguang
deepin
2016-06-10 02:16
#4
sorry, seems you have tried rc.local, can you execute your commands without root permission?
Reply View the author
xolotl
deepin
2016-06-10 02:54
#5
Yeah I can execute the command without permission, which I couldn't do in other distros. Another strange thing with this problem in other distros was a successful config edit would be reverted due to the way alsa/pulseaudio works (or something). A delay solved it then. Still not sure on what to do now though?
Reply View the author
laoguang
deepin
2016-06-10 03:43
#6
https://bbs.deepin.org/post/31138
Yeah I can execute the command without permission, which I couldn't do in other distros. Another str ...

well, i am not really an expert at this area, i will see what i can do for you.
Reply View the author
laoguang
deepin
2016-06-10 03:45
#7
Reply View the author
xolotl
deepin
2016-06-10 17:36
#8
Holy guacamole! The .bashrc suddenly started working! I've tested it powering off, restarting, logging out and more. It works great except 1 time in 6 where it didn't work. A little weird but I'll live it for a while and see how good of a solution it is. Thanks everyone.
Reply View the author