how to run a specific command via a bash script and add in to a 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.

Replay

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

how to run a specific command via a bash script and add in to a startup

then you get this:

how to run a specific command via a bash script and add in to a startup

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

Category: 14.04 Time: 2016-07-29 Views: 0

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.200 (s). 12 q(s)