User Tools

Site Tools


process_check_script_for_cron

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

process_check_script_for_cron [2009/06/04 15:00]
k2patel created
process_check_script_for_cron [2020/08/10 02:35]
Line 1: Line 1:
-==== Process Check script for cron ==== 
  
-This script will check process if it is not running ​ 
-and will start the process if not running. 
- 
-<code bash | proc_script.sh>​ 
-#!/bin/bash 
-# check process 
-ps -ef | grep -v grep | grep 2200:​localhost:​22 
-# if not found - equals to 1, start it 
-if [ $? -eq 1 ] 
-then 
-ssh -f -N -R 2200:​localhost:​22 k2patel@71.245.248.138 
-echo "​Process not running - Started"​ 
-else 
-echo “Process Running - do nothing” 
-fi 
-</​code>​ 
- 
-I made some changes as there is actually no need to equality check: 
- 
-<code bash | proc_scriptjt.sh>​ 
-#!/bin/bash 
-# check process 
- 
-# if can parse the statement and watch the exit code 
-if ps -ef | grep -v grep | grep 2200:​localhost:​22 
-then 
-ssh -f -N -R 2200:​localhost:​22 k2patel@71.245.248.138 
-echo "​Process not running - Started"​ 
-else 
-echo “Process Running - do nothing” 
-fi 
-</​code>​ 
process_check_script_for_cron.txt · Last modified: 2020/08/10 02:35 (external edit)