I have a few basic commands that I need to run on a Red Hat Linux 5 Virtual Machine with GNOME to start a couple servers.
Example
cd /home/user/scripts
sh runTHISthing.sh pub
cd /home/user/logs
tailf pub.log Not a crazy amount of code but sometimes I restart VM several times a day. In Windows, I would probably just create a batch file and put it on my desktop. Then it's just a matter of double clicking and off it goes.
Is there anyway to do the same in Linux? I've tried to create a launcher that just runs the emtpy file in terminal with no result.
21 Answer
In UNIX, a 'batchfile' is known as a shell script. A typical BASH shell script will start with a magic line that tells the operating system which shell to execute the script with, so your example would end up:
#!/bin/bash cd /home/user/scripts sh runTHISthing.sh pub cd /home/user/logs tailf pub.logNOTE: After you create the file, you have to mark it as executable, in order for the OS to try executing it:
chmod +x myscript 2