Shell script with nohup is not working

The code which is working fine independently is not working with nohup

Program is to check for any new file generation on particular folder

if [[ $name == * ]]; then
  echo "core file generated in the $path with core file name $name"
  fi

Getting the error " [[ksadsasassdds: command not found"

ps: "ksadsasassdds" this is the value of name

Please, double quote the "$name" variable.

What are you comparing it with, what is * meaning in if condition ?

Regards
Peasant.

Thanks for the reply , i just to check if the file is generated or not

#Waiting in a loop for core file generation on the directory user specified

inotifywait -q -e create -m $DIR  | while read path events name;
 do
  if [[ $name  == * ]]; then
  echo "core file generated in the $path with core file name $name"
  #calling pythin script for sending notification to user
  python mail.py $path $name $EMAIL
  fi

Check out incrond for inotify usage.

Please use code tags for your future queries!

Here is a simple example incorporating your code for check, please declare MAIL variable, as i did not.

#!/bin/bash
python mail.py $1 $2 $MAIL

And incron installed with entry as follows :

/directory/to/watch	IN_CLOSE_WRITE,IN_MOVED_TO   /path/to/script/script.sh $@ $#

Hope that helps
Regards
Peasant.

2 Likes

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.