Hello,
I couldn't find any information from the web on how to make a shell script which can automatically execute commands that require "su" privileges during user login.
I have read that I can store the shell script at "/etc/profile.d/" location which did not exist by default and I had to create one. However, I did so and the script does not load during login.
Here is my script:
This is the directory location where I stored it:
The usage of "/etc/profile.d/" and documentation conjecture of it from the FreeBSD man page doesn't go into details:
Basically what I would like to do is to run the following command automatically which requires to be run as root/su user:
The above command is weird, you can not close the terminal and it needs to be actively running with the terminal open. If the terminal is closed using "ctrl-z", the entire "webcamd" services will crash and have no idea how to fix it, need to restart FreeBSD again. So basically I need to run this command as a background service/process and should only start when user logins.
Also, I would like to automatically execute commands at/during user login not during system startup or boot phase.
Need it to be both for FreeBSD console login and also for GUI KDE Desktop environment login as well.
I would like to run the command in a custom created script file, do not like the idea to put script lines of code for custom software in system related script files which contains code already for system related services, it is messy and not my way for simplicity and proper organization. Would like to create scripts and place it in a location if possible.
As of now, I would like the script file to take in effect for the entire user community or for specific user, does not matter.
Thanks for any information.
I couldn't find any information from the web on how to make a shell script which can automatically execute commands that require "su" privileges during user login.
I have read that I can store the shell script at "/etc/profile.d/" location which did not exist by default and I had to create one. However, I did so and the script does not load during login.
Here is my script:
Bash:
#!/bin/sh
webcamd -c v4l2loopback
This is the directory location where I stored it:
/etc/profile.d/v4l2loopback_1.sh
The usage of "/etc/profile.d/" and documentation conjecture of it from the FreeBSD man page doesn't go into details:
profile(4)
www.freebsd.org
Basically what I would like to do is to run the following command automatically which requires to be run as root/su user:
webcamd -c v4l2loopback
The above command is weird, you can not close the terminal and it needs to be actively running with the terminal open. If the terminal is closed using "ctrl-z", the entire "webcamd" services will crash and have no idea how to fix it, need to restart FreeBSD again. So basically I need to run this command as a background service/process and should only start when user logins.
Also, I would like to automatically execute commands at/during user login not during system startup or boot phase.
Need it to be both for FreeBSD console login and also for GUI KDE Desktop environment login as well.
I would like to run the command in a custom created script file, do not like the idea to put script lines of code for custom software in system related script files which contains code already for system related services, it is messy and not my way for simplicity and proper organization. Would like to create scripts and place it in a location if possible.
As of now, I would like the script file to take in effect for the entire user community or for specific user, does not matter.
Thanks for any information.