This is the error you get if you try to search in an empty directory:
$ tree
.
├── dir
│ └── file
└── empty_dir
2 directories, 1 file
$ grep foo dir/* ## works, no error
$ grep foo empty_dir/*
grep: empty_dir/*: No such file or directory
Basically, when you run something like grep ./*
, the glob (*
) is interpreted by the shell which will expand it to the contents of the directory you gave. If the directory is empty, that expands to nothing and the shell returns an error. You will get the same error irrespective of which program you use:
$ ls empty_dir/*
ls: cannot access empty_dir/*: No such file or directory
So, I'm guessing that ~/5as-darbas/inputs/multiple_dir/
is empty. This is not a big deal and you can just ignore the error. If you want to deal with it more gracefully, you could give the directory name (no glob) and run a recursive grep
:
$ grep -R foo empty_dir/
To do this with your current setup, change `~/5as-darbas/inputs/multiple_dir/*
to ~/5as-darbas/inputs/multiple_dir/
and give grep -R
as the first argument to your script:
$ myscript.sh 'grep -R' regExp/regExp tests/MULTIPLE.inp outputs/MULTIPLE.out
Best Answer
Cron jobs can be run as root or another specified user. If that user does not have the permission to write to the
.sql
file the job will fail.If the file exist and it has write permission for the user running the job the file will be written.
if the file does not exist and the user does not have permission to create files in target directory, the job will fail.
I can typically say
now I can say:
but if the file does not exist it will fail, as I have no permission to create files in
/var/log/
.So question becomes if the user running the job have the right to create files where ever the output from
mysqldump
is written.Now if I set up a cron job to run a script with this:
every minute, I can add:
to
/etc/crontab
. As I have no permission to create files in /var/log/ the cron daemon will send me an email when the job fails.After 1 minute there are no file. I go to a terminal and type
mail
:OK. My bad. I create the file and chown it to me. Now all is OK.
Have a look at these as well: