I have developed a bash script named njsearch
that should perform a search in a given folder, and save the log inside auditlogs.log
file:
#!/bin/bash
logs_dir=/var/log/mylogfolder
mydata=/path/to/mydata
daysbefore=1
Find()
{
truncate -s 0 $logs_dir/auditlogs.log
echo "Searching files .$1"
find $mydata/ -mtime -$daysbefore -name *.$1 >> $logs_dir/auditlogs.log
cat $logs_dir/auditlogs.log
}
# Get the options
while getopts ":hmkaro:" option; do
case $option in
h) # Display Help
Help
exit;;
m) # Find mp4
Find mp4
exit;;
k) # Find mkv
Find mkv
exit;;
a) # Find avi
Find avi
exit;;
r) # Find rar
Find rar
exit;;
o) # Enter new file format
namedial=$OPTARG
Find $namedial
exit;;
\?) # Invalid option
echo "Error: that's not a valid option"
exit;;
esac
done
This script works great, the problem comes when I generate the .deb installer file following the steps explained here. Once installed, the script does not perform the searches.
I'm missing something here about creation and compilation this script for being part of Debian OS?
PS: I checked the +x
permission for the script, and nothing
Any solution to this?
UPDATE: I recently found out that after installing it, if I do a logout - login, then this script works without any problem.
Any ideas?