You are not logged in.
I'm pretty new to linux so bear with my limilted knowledge
I wrote a simple shell script to switch between the intel and nvidia graphics in my optimus enabled laptop(bumblebee performance wasn't quite as good as the real thing). Basically it shuts down the display manager, moves some symlinks around, loads/unloads drivers, then fires gdm up again. It works perfectly from a terminal (CTRL+ALT+F2), however I can't launch it from inside an Xorg session as the first thing the script does is kill off that session....is there anyway around this? Is there someway to launch a script independant of the Xorg session so I just click a shortcut and a few seconds later I'm back in Xorg on the other video card?
Last edited by mwarner (2014-09-11 01:19:20)
Offline
The most direct answer to your initial question is to use setsid and/or nohup. The script is killed as it's parent process gets killed. setsid reparents it to PID 1, so it never gets the SIGHUP while nohup just makes it ignore the SIGHUP.
But a much cleaner way of doing this would be to just launch it from PID 1 in the first place: make a systemd service file for it.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Thanks Trilby, systemd is a perfect solution! I've now got a working solution that lets me switch cards with the click of a button ![]()
Offline
Wise men say: He who marks his topics as solved does not attract helpers for nothing.
Offline