I want to capture a last file in a directory in a shl scrip
Cd to the directory
$last ls -1 *the_bills.dat* | tail -1
This is not problem, but I need to copy that file to another directory, but in order to be able to copy to that directory, I need to su in unix, I am sure my sistem administrator does not want to see the password harcode in my shl script how I can do that?
This is more of a sysadmin problem than a programmer problem.
1. get him to set up sudo for you, such that you can
This could be pfexec on Solaris 10.
2. set up ACL's or group access on the directory in question, to allow you to mess with the files.
Any script will have a password - expect, here document, etc.
Slightly secure:
If the script runs in production in your username ( or a special username) create
a file with 700 permissions for the user. Put the password in it. Read the password in the script. Or set 700 on the script file and leave the password in it.
Thanks Jim, I agree but she is not a nice human being(believe me!)
After I move the file to that directory, I need to gzip and encrypted.
I never do this in a shl script, I do it from the command line and it works..
cd /home/nelnet
spinel:/home/nelnet$ gpg -e 2010_11_07_05_11_xxxxxx_bills.dat.gz
gpg: WARNING: unsafe permissions on configuration file `/home/nelnet/.gnupg/gpg.conf'
gpg: WARNING: unsafe enclosing directory permissions on configuration file `/home/nelnet/.gnupg/gpg.conf'
You did not specify a user ID. (you may use "-r")
Current recipients:
Enter the user ID. End with an empty line:
You did not specify a user ID. (you may use "-r")
Current recipients:
Enter the user ID. End with an empty line: epass
This works in the command line, it gzip and encrypted the file
If you can point me in the right direction, I will appreciated
I have a script, which is checking if file exists and move it to another directory
if
then
mkdir -p ${LOCL_FILES_DIR}/cool_${Today}/monthly
mv report_manual_alloc_rpt_A_I_ASSIGNMENT.${Today}*.csv ${LOCL_FILES_DIR}/cool_${Today}/monthly
... (9 Replies)
I need a script which should watch a directory for a file with specific directory.
If it finds a file in directory, it should search for few specific keyword in the file. if the keyword exists, it should trim string from specific column.
The file should be moved to another directory and the a... (8 Replies)
Script must removes files from the first directory if there is a file with same name in the second directory
Script passed to the two directories, it lies with them in one directory:
sh script_name dir1 dir2
This is my version, but it does not work :wall:
set - $2/*
for i
do
set -... (6 Replies)
I have the following in a shl script:
SCRIPT_PATH="/u01/app/banner/test/skid/plus/";
FILE_PATH="/nfs/mercury/u03/banner/test/skid/log";
LIST_FILE_PATH="/u01/banjobs/TEST";
SCRIPT_NAME="szpcal1.sql";
FILE_NAME='new_applicant_list';
I want to copy the file FILE_NAME to LIST_FILE_PATH
... (10 Replies)
I need to decrypt a file in a directory, I need to write a shl scrip & cron job
How I find the files in the directory:
the file is like this:
dailypayments_sfs_payment_201011151800.dat -d
The decrypt command:
gpg -o dailypayments_sfs_payment_201011151800.dat -d
20101115 (the date... (7 Replies)
After I move the file to a directory, I need to gzip and encrypted.
I never do this in a shl script, I do it from the command line and it works..
cd /home/nelnet
spinel:/home/nelnet$ gpg -e 2010_11_07_05_11_xxxxxx_bills.dat.gz
`/home/nelnet/.gnupg/gpg.conf'
`/home/nelnet/.gnupg/gpg.conf'... (3 Replies)
When I run this code from the command line works
spinel.middlebury.edu:/u02/sct/banner/bandev2/middlebury/shl:DEV2$ ls ef*
eftseq.dat
spinel.middlebury.edu:/u02/sct/banner/bandev2/middlebury/shl:DEV2$ file_seq=$( < eftseq.dat) ... (1 Reply)
have this shl that will FTP a file from the a directory in windows to UNIX, It get the name of the file stored in this variable $UpLoadFileName then put in the local directory LocalDir="${MPATH}/xxxxx/dat_files" that part seems to be working, but then I need to take that file and rename, I am using... (3 Replies)
I am trying to read a file in a shl script (only one record) and stored in a variable file_number
I got the following
read -u $BANNER_HOME/xxxxxxx/misc/EFTSQL.dat file_number
file_number2 = $file_number + 1
echo $file_number2 > $BANNER_HOME/xxxxxx/misc/EFTSQL.dat
EOF
It is not working... (2 Replies)
need to be able to capture a file with the following conditions:
The filenames are, for example, 3526_332840.dat, where 3526 is constant, and 332840 is a sequential number which is always a couple hundred greater than the previous day's file.
I want to be able to change this script to acoomplish... (1 Reply)