How to run time consuming commands on server and also do benchmarking

How to run time consuming commands on server and also do benchmarking

Make a shell script file.

nano script_benchmakring.sh
#!/bin/bash
echo `date` > /home/log.txt
sleep 5
echo `date` >> /home/log.txt

You can place any command in the script in place of “sleep 5”. We are using sleep command to verify everything is working fine and time difference is being recorded.
Now we will make this script executable

chmod +x /home/script_benchmakring.sh

We will run this script which will sleep for 5 seconds and log time for benchmarking

sh /home/script_benchmakring.sh

You can see the benchmarking for this script execution.

nano /home/log.txt

 
To be on a safer side i use “screen” command. ┬áSome commands require hours for execution and putty gets disconnected when internet goes off or my system is shutdown or in sleep mode. “screen” commands maintains the state of the session in which my scripts are running.
 

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *