Write shell script for the following task
- Change to /disk1/kafka directory
- Check if there exists file ‘my.pid’ is present
- Output ‘pid file not found’ if file is not present
- If the file is present, get contents of this file which will be a PID
- Check if any process if running with this PID
- Output ‘kafka is running with $PID’ if found
- Output ‘kafka is not running with $PID’ if not found
>Solution :
How about a list of PowerShell commands for you to research and then you can put this together as a script – come back with more questions if you don’t get it working:
Set-Locationor its common aliascdTest-PathWrite-Host,Write-Error,Write-Warning,Write-OutputGet-ContentGet-Process- See 3.
- See 3.