- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Help (again)
Categories
Company
Local Language
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2009 06:45 AM
03-03-2009 06:45 AM
/tmp/list1.29752 not found
*************************************************
Cron: The previous message is the standard output
and standard error of one of your crontab commands:
/usr/local/bin/filesystemcheck.sh
IS there a way I can modify the script to use "touch" to create necesary files to ensure they are there?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2009 06:49 AM
03-03-2009 06:49 AM
Re: Help (again)
Most certainly you can use 'touch' to create files to insure their presence. Of course, you can also test for their presence too:
# FILE=/tmp/mylist
# [ -f "${FILE}" ] && echo "${FILE} exists" || touch ${FILE}
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2009 07:31 AM
03-03-2009 07:31 AM
Re: Help (again)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2009 07:51 AM
03-03-2009 07:51 AM
Solution> would I slide those in after the dt= line?
I don't see anything in the attached script that has the string "list" in it.
As for this code:
dt=`date +bdf%m%d%y%H`
existence=`ll /tmp | grep $dt`
if [ -n "$existence" ]
then
exit
fi
...It assumes that the file named by the value of '${dt}' exists if it lives in the '/tmp' directory. A much better approach might be:
cd /tmp && exit 1
dt=$(date +bdf%m%d%y%H)
[ -f "${dt}" ] || exit
...which would exit if the file didn't exist.
If you want to create the file if it isn't there, do what I first suggested:
cd /tmp && exit 1
dt=$(date +bdf%m%d%y%H)
[ -f "${dt}" ] || touch ${dt}
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2009 08:04 AM
03-03-2009 08:04 AM
Re: Help (again)
cd /tmp && exit 1
dt=$(date +bdf%m%d%y%H)
[ -f "${dt}" ] || touch ${dt}
and I added a -x to the shebang, but all it does is gives me:
+cd
+exit
and nothing else runs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2009 08:10 AM
03-03-2009 08:10 AM
Re: Help (again)
> cd /tmp && exit 1
Oops, my reversed thinking. This says "cd to /tmp" but if you DO (successfully) then 'exit' ! I meant:
# cd /tmp || exit 1
...meaning if you can't change directories to /tmp, then exit.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2009 08:14 AM
03-03-2009 08:14 AM
Re: Help (again)
+ [ -fbdf03030910]
/usr/local/bin/filechecktest.sh[23]: test: A ] character is missing.
Thoughts on it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2009 08:26 AM
03-03-2009 08:26 AM
Re: Help (again)
> usr/local/bin/filechecktest.sh[23]: test: A ] character is missing
...means that at (about) line-23 of your script in a 'test' operation, a bracket wasn't found where/when expected.
Since you see:
+ [ -fbdf03030910]
I you didn't observe the proper whitespace rules (the shell is picky). Be sure you wrote:
[ -f "${dt}" ] || touch ${dt}
...note too that we double-quote the variables in the 'test' command (that in square brackets). This protects us from errors if the 'dt' variable is empty, which would evaluate syntatically OK.
Compare these:
# XFILE=""
# [ -f ${XFILE} ] || echo no-file
sh: test: Specify a parameter with this command.
...with:
[ -f "${XFILE}" ] || echo no-file
no-file
Regards!
...JRF...
...wh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2009 08:39 AM
03-03-2009 08:39 AM
Re: Help (again)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2009 09:11 AM
03-03-2009 09:11 AM
Re: Help (again)
I would also suggest a space after -f or any other test operator.
- Tags:
- Test