'How to execute new command of same script after reboot
I am trying to implement a service which will execute a script which has 2 or more fio tests to execute. System Used: UBUNTU 18.04(x86)
Requirement: If script has ./fio1 reboot ./fio2 so after reboot I want ./fio2 to get execute automatically? Using reboot command between two executable is not working. What could be the possible way for this?
Tried sample code
#!/bin/bash
if [ -d "/home/ankita/workspace/fio" ]
then
{
echo "Directory /home/ankita/workspace/fio exists."
cd fio
runtime="75 minute"
endtime=$(date -ud "$runtime" +%s)
while [[ $(date -u +%s) -le $endtime ]]
do
echo "Time Now: `fio --name=randrw --ioengine=libaio --iodepth=1 --rw=randrw --bs=64k --direct=1 --size=512m --numjobs=8 --runtime=1800 --group_reporting --time_based --rwmixread=35`"
reboot
echo "Time Now: `fio --name=randrw --ioengine=libaio --iodepth=1 --rw=randrw --bs=64k --direct=1 --size=512m --numjobs=8 --runtime=1800 --group_reporting --time_based --rwmixread=90`"
echo "Sleeping for 3 minute"
echo "Done"
sleep 3m
done
}
else
{
echo "Error: Directory /home/ankita/workspace/fio does not exists."
git clone https://github.com/axboe/fio.git
cd fio
echo 1234 | sudo -S ./configure
echo 1234 | sudo -S make
echo 1234 | sudo -S make install
echo "*******start******"
runtime="75 minute"
endtime=$(date -ud "$runtime" +%s)
while [[ $(date -u +%s) -le $endtime ]]
do
echo "Time Now: `fio --name=randrw --ioengine=libaio --iodepth=1 --rw=randrw --bs=64k --direct=1 --size=512m --numjobs=8 --runtime=300 --group_reporting --time_based --rwmixread=90`"
echo "Sleeping for 3 minute"
echo "Done"
sleep 3m
done
}
fi
This is to check filesystem performance during power failure. Let me know if more details required.
Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
