Bash Script - Unmatching files
Go to solution
Solved by WiiManic,
Since you haven't given a full path, I'd expect the file in L1 will be being outputted to the home folder of which ever cron user you've got running the job.
That will most likely be yours or the root user's home folder.
When you run it as your user manually (with ./gentest.sh), it will just default to making the file in whichever you are currently in.
Swapping targetFile to "/home/<USERNAME>/.ssh/testfilegen2.log" or to wherever you want the file to be stored sounds like it will fix it.
In general, always give a full file path, since it then means the file will always be where you expect it, no matter where you run the script.

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now