	   
Automatic EVN GPS data processing and transfer scripts
------------------------------------------------------
Here's the files used by Onsala for automatic processing and ftp'ing of GPS data. 
The automation scripts are probably quite OSO specific so they'll need some tweaking to 
work for other stations. Automation scripts are bash shell scripts and the AWK scripts 
are used for processing the GPS data and are probably quite generic.

The main script for processing gps data is day.sh, it should be run daily by cron once 
every day, make sure to edit the script to fit your system.

For the FTP transfer the ftplog.sh script is used, it should also be run once a day by 
cron but after the day.sh, also don't forget to edit it to fit your and the remote system.
See the script files for details.

Feel free to email me (Fredrik Corneliusson) at fredrikc@oso.chalmers.se


The OSO System setup
--------------------
Our computer system is a PC with SuSE Linux 5.3 with GNU bash 2.01.1 
and GNU bc 1.04.

The GPS-OSO difference is measured by a HP-51131A universal counter which
is read by the Linux computer over a GPIB interface.

GPS time files have the dayno and time diff separated by a tab and ends
with a new line. The sample time is 30s and every day has it's own separate
file with the format time_YYYY_DDD.log. 
e.g.
Dayno.          GPSdata
DDD.ddddd\t	T.ttttt\n


PROCESSING SCRIPTS:
------------------
	day.sh
	------ 
	Main script that creates month subdir and does the process of copying 
	and filtering ~/maser/log/time_yyyy_ddd.log to ~/scripts/monthYY/time_ddd.log. 
	Then makes 1000s average using 'awk.1000.com' before making/appending 
	the oneday average file 'monthYY.oneday' using the 'awk.oneday.com'.
		usage: ./day.sh datestr

	month.sh
	--------
	Processes a month of data by calling day.sh for all days i the specified month.
		usage: ./month.sh month year

	mjd.sh
	------
	Converts gregorian time to Modified Julian Day, used by day.sh to supply 
	'awk.oneday.com' with start of year MJD.
		usage: ./mjd.sh datestr

	awk.1000s.com
	-------------
	Invoked by day.sh to generate 1000s average from a time_ddd.log file.

	awk.oneday.com
	-------------
	Invoked by day.sh to generate oneday average from 1000s average.


FTP SCRIPTS:
-----------
	ftplog.sh
	---------
	Picks the './monthYY/monthYY.oneday' file and transfers it to '~/gps/monthYY/gps.??' 
	using 'ftpput.sh'. Contains password and login to ftp server so it should have 
	700 rights.
		usage: ./ftplog.sh datestr

	ftpput.sh
	---------
	Writes the '~/.netrc' file used by the ftp command to perform scripting.
	before invoking 'ftp -i' to ftp the file.
	Caution!! it will overwrite and delete the .netrc file in the users home directory.
	It would be appreciated if someone would replace this with a more robust 
	script.
	
	

CRONTAB:
-------
	.crontab
	--------
	The .crontab file we use is supplied as crontab.txt, see it for details.


OSO DIRECTORY LAYOUT
----------------
OSO directory layout after running day.sh script 1st day of year for first time.

$HOME---|
	|-maser----|
	|          |-log---|
	|	           |-time_yyyy_ddd.log
	|
	|-scripts--|
	|	   |-JanYY-|
	|	   |       |-time_ddd.log
	|	   |       |-JanYY.1000s
	|          |       |-JanYY.oneday
	|	   |
	|	   |-day.sh
	|	   |-month.sh
	|	   |-mjd.sh
	|	   |-awk.1000s.com
	|	   |-awk.oneday.com
	|	   |-ftplog.sh
	|	   |-ftpput.sh
	|	   
	|-.netrc	   
	|-.crontab	   



Fredrik Corneliusson <fredrikc@oso.chalmers.se>
Onsala Space Observatory 2000-05-12.
