Operating System - HP-UX
1847235 Members
2780 Online
110263 Solutions
New Discussion

daily script to pull reports.

 
SOLVED
Go to solution
Wilmar Ricio
Occasional Advisor

daily script to pull reports.

I'm trying to create a script to run daily, post it in cron. What it have to do is move all reports from a /tmp dir generated the previous night to our /opt/ns-ftrack/docs-httpd-default so I can post it to our Intranet for the users to view it. The reports are generated daily, 7/days/week.

Help.
4 REPLIES 4
Kofi ARTHIABAH
Honored Contributor
Solution

Re: daily script to pull reports.

Wilmar:

I think we need more information:
1. The reports, are they HTML?
2. What generates the reports?
3. Why are the reports generated to /tmp in the first place? Why are they not installed in the httpd-default directory, directly.

you could try someting like this: suppose your reports are called report-yyyy-mm-dd.html, you could have the following cron entry:

0 03 * * * /bin/cp /tmp/report-*html /opt/ns-ftrack/docs-httpd-default > /dev/null 2>&1
nothing wrong with me that a few lines of code cannot fix!
Stefan Farrelly
Honored Contributor

Re: daily script to pull reports.


We do a similar thing using Ignites wonderful print_manifest command, and then publish it on our Netscape fasttrack server on the intranet for users to view daily. On each server we run this cronjob/script (using a .netrc file to ftp automatically);

#! /bin/sh
#
# FTP Server Manifest and backup reports to orion Web Server
#
DATE=`date +%d%m%y`
MANIFEST_OUTPUT=`hostname`_manifest
DESTINATION_HOST=orion
DESTINATION_CONFIGDIR=/opt/ns-ftrack/docs-httpd-default/system_config
DESTINATION_BCKRPTS=/opt/ns-ftrack/docs-httpd-default/backup_reports/`hostname`
/opt/ignite/bin/print_manifest > /tmp/$MANIFEST_OUTPUT
ftp $DESTINATION_HOST <lcd /tmp
cd $DESTINATION_CONFIGDIR
put $MANIFEST_OUTPUT
cd $DESTINATION_BCKRPTS
put daily_backup.out daily_backup.out.$DATE
quit
EOF
mv /tmp/daily_backup.out daily_backup.old

And from anyones browser they can just type into the location; orion and this picks up the /opt/ns-ftrack/docs-httpd-default/index.html file which allows users to select backup reports or print_manifest output.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Mark Mitchell
Trusted Contributor

Re: daily script to pull reports.

how about something simple

cd /location
mv xxxx /newplace/xxxx
mv yyyy /newplace/yyyy

or for all files
cd /location
find . -depth -print|cpio -ocdumvB /newplace
Mark Mitchell
Trusted Contributor

Re: daily script to pull reports.

sorry, it should be
find . -depth -print|cpio -ocdumvB > /newpl