I want to execute this command in Ubuntu 14.04
sudo ./crclient -u username -i eth0
I will use it for login in cyberrom client. So need some help to create a bash script and add in to a startup like windows startup.
I want to execute this command in Ubuntu 14.04
sudo ./crclient -u username -i eth0
I will use it for login in cyberrom client. So need some help to create a bash script and add in to a startup like windows startup.
Here is the code you want to make in a shell script.
#!/bin/sh
echo -n "Enter your username and press enter: "
read name
sudo ./crclient -u $name -i eth0
in ubuntu open dash (the ubuntu button) and type startup
then you get this:
Press add and type at the command rule:
incase of the ubuntu terminal
gnome-terminal -x "sh /path/to/script.sh"
incase of xterm (which i prefer)
xterm -e "sh /path/to/your/script.sh"
then reboot and see if it works :)
---------------------------EDIT---------------------------
make a new file in /etc/xdg/autostart
using nano/vi or a text editor and name it test.dekstop
copy this into it
[Desktop Entry]
Name=MyScript
GenericName=test
Comment=test
Exec=/path/to/my/script.sh
Terminal=true
Type=Application
X-GNOME-Autostart-enabled=true
reboot the pc afterwards
______________________EDIT 2______________________
To allow the command to run without sudo asking for a password, do the following:
visudo
scroll all the way down and add this
linuxusername ALL= NOPASSWD: path/to/crclient
save and exit
sudo ./crclient -u username -i eth0
that's the command, but how does one enter the password?
sudo ./crclient -u username -i eth0 -p password?
– patrick Jul 29 '16 at 08:07xterm -e "sh /path/to/your/script.sh"
or
gnome-terminal -x "sh /path/to/script.sh"
the xterm one only works with the xterm program, the gnome-terminal one is the one you need if you don't have xterm
– patrick Jul 29 '16 at 08:17name : abc command : .sh file path comment : xyz
– Tech T Jul 29 '16 at 08:41name: abc command: gnome-terminal -x "sh /path/to/script.sh" comment: Testoroonie
– patrick Jul 29 '16 at 08:42Exec=/path/to/my/script.sh
to
Exec=gnome-terminal -x "/path/to/my/script.sh"
– patrick
Jul 29 '16 at 09:07
xterm -e "sh /path/to/script.sh"
– patrick
Jul 29 '16 at 09:24