Hot answers tagged scripting
Google says cron would be best for this, but I don't want it to be recurring. Forget about PRTG for anything but monitoring and notifications. It's true - cron jobs are recurring. However, all you need to do is write a simple wrapper script that gets run by cron at the top of each hour - this script would: Check if your program is running. If it is, ...
Use echo to inspect the $CHECK_SYSTEM string returned by your command, it is not what you think it is. You will need to further process it to remove some whitespace. You may find the virt-what command more useful if it is installed on the system e.g. # virt-what vmware or # virt-what kvm virt-what is a shell script so you can easily add a copy to ...
@Iain is correct that this script is likely not doing what you need, however in general if you're looking to compare strings you're missing an equalsign, this would probably work better: if [ "$CHECK_SYSTEM" == "Product Name: VMware Virtual Platform" ] ; then See this excellent thread for more: ...
Value of your $testfile is "grep Have aims.out | cut -c11-14" which is definitely NOT equals to "Have". That's why you are not entering second if-block at all. If you want to execute grep statement and assign its result to variable, you need to replace quotes with backticks: testfile=`grep Have aims.out | cut -c11-14`
Only top voted, non community-wiki answers of a minimum length are eligible