Hardcode password in a do shell script not working
I have been trying to solve something i have wanted to do for a long time, that is get a script that changes the ammount of time before the display goes to sleep. I tried GUi scripting but in system preferences the changes made to the slider did not stay. So i have now come onto a do shell script. Found below. I would prefer to just hardcode my password into it however this does not seem to work. Any ideas ?
set exitflag to false
try
repeat until exitflag is true
set {text returned:Sleeptime, button returned:sleepstate} to (display dialog "Minutes before display sleep" & return & "Between 1 and 180 mintues" & return & "Greater than 180 means never sleep" default answer "1" buttons {"Cancel", "OK"} default button 2)
set Sleeptime to Sleeptime as number
if Sleeptime is less than 1 then
set exitflag to false
else if Sleeptime is greater than 180 then
set Sleeptime to 0
set exitflag to true
else
set exitflag to true
end if
end repeat
end try
set Sleeptime1 to Sleeptime as string
set Sleeptime1 to quoted form of Sleeptime1
set psswd to quoted form of "XXXXX"
do shell script "sudo pmset -a displaysleep " & Sleeptime1 password psswd
set pete to do shell script "sudo pmset -g"
set xx to text -2 thru -1 of pete
if xx - Sleeptime = 0 then
tell application "SEC Helper"
show screen message "Worked:" & return & xx & " mintues"
end tell
else
tell application "SEC Helper"
show screen message "Failed!"
end tell
end if
1) don't use 'sudo' in a 'do shell script'. It isn't necessary and will sometimes break.
2) do not use 'sudo' in a 'do shell script'
3) do not use... I'm sure you get the idea.
It is not necessary to use 'sudo' in a 'do shell script' command. 'do shell script' itself takes care of the authentication element when you use 'with administrator privileges'. Therefore the appropriate way of doing this is:
<pre class=command>do shell script "pmset -g displaysleep " & sleeptime1 with administrator privileges password psswd</pre>
If you omit the 'password psswd' element the user will be prompted to authenticate using the standard system authentication dialog.
The problem you're running into is that the 'password' parameter is only valid when you use 'with adminitrator privileges', and is therefore getting ignored in your current script.
Similar Messages
-
My cold backup shell script not working
I have written a shell script for cold backup but. It says that line 42 has unexpected syntex error '{' and line 57 unexpected end of file. Please help
BKUP_DIR=/u03/backups/abu/nightly_backup
LOG_FILE=/u03/backups/abu/backup.log
ORACLE_HOME= /u01/app/oracle/product/10.2; export ORACLE_HOME
ORACLE_SID=SEED; export ORACLE_SID
PATH="$PATH:$ORACLE_HOME/bin";export PATH
# Execute the backup procedure
echo ymd=`date +%Y%m%d` >> $LOG_FILE
echo "Database BACKUP starting." >> $LOG_FILE
ORACLE_HOME=/u01/app/oracle/product/10.2; export ORACLE_HOME
ORACLE_SID=SEED; export ORACLE_SID
PATH="$PATH:$ORACLE_HOME/bin";export PATH
rman target=/ << EOF
shutdown immediate
EOF
if [ $? -eq 0 ]
then
mkdir -p ${BKUP_DIR} # make directory
echo "Database shut down.">> $LOG_FILE
else echo "not shutdown".>> $LOG_FILE
fi
if [ ! -d ${BKUP_DIR} ]
then
echo "Not a directory: ${BKUP_DIR}">> $LOG_FILE
exit 1
fi
echo "Previous Backup is being removed." >> $LOG_FILE
rm ${BKUP_DIR}/${ymd-${seed}.gz >>$LOG_FILE
echo "Cold backup being performed." >> $LOG_FILE
cp /u01/app/oracle/admin/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gz #copying database files into new dir
cp /u02/oradata/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gz
cp /u03/oradata/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gz
echo "Cold backup of archive logs being performed." >> $LOG_FILE
mv /u01/app/oracle/product/10.2/dbs/arch/* ${BKUP_DIR}/$ymd-${cmsv}.gz
gzip ${BKUP_DIR}/$ymd-${cmsv}
echo "Restarting Database" >> $LOG_FILE
rman target=/ << EOF
startup
EOF
else
echo "Database will NOT start up." >> $LOG_FILE
fi
echo 'ymd='date +%Y%m%d' >> $LOG_FILE
echo "Database BACKUP has completed." >> $LOG_FILE
exitI trying to write that script for our new production database. My script will create a folder automatically and will copy all database files into the folder. Now my script dont copy the files into the direcory that automatically create. I want my directory name with timestamp that i already speciy in my code. The scripts now generate an error that now such files or directory. I mean when it tries to copy files from source to destination folder. Please give me some suggestions.
if [ $? -eq 0 ]
then
mkdir -p ${BKUP_DIR} # make directory
echo "Database shut down.">> $LOG_FILE
else echo "not shutdown".>> $LOG_FILE
fi
if [ ! -d ${BKUP_DIR} ]
then
echo "Not a directory: ${BKUP_DIR}">> $LOG_FILE
exit 1
fi
echo "Previous Backup is being removed." >> $LOG_FILE
rm ${BKUP_DIR}/${ymd-${seed}.gz >>$LOG_FILE
echo "Cold backup being performed." >> $LOG_FILE
cp /u01/app/oracle/admin/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gz #copying database files into new dir
cp /u02/oradata/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gz
cp /u03/oradata/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gzecho "Cold backup of archive logs being performed." >> $LOG_FILE -
Process Flow - User Defined object calling Unix Shell script not working
Hi, I have a User Defined Object in a Process Flow with the following parameters :-
Command: /usr/bin/ksh
Parameter List:
Result Code:
Script: cd /shell_scripts
./dwh_get_datafile.sh param1 param2 param3
Success Threshold: 0
The script executes but it does not correctly interpret all the Unix commands within it e.g command such as FTP, DATE, GREP etc.
In the job details I can see :-
./dwh_get_datafile.sh: date: not found
./dwh_get_datafile.sh: ftp: not found
./dwh_get_datafile.sh: grep: not found
./dwh_get_datafile.sh: rm: not found
./dwh_get_datafile.sh: ls: not found
./dwh_get_datafile.sh: awk: not found
Anyone know what I have done wrong ?
The script runs fine when run as a Unix script while logged into Telnet.
Thanks.
PaulThe shell script is executed by the oracle user in the unix environment so make sure that the directorie where you can find the unix commands exists in the path for the oracle user in .profile as you can se in my example below.
PATH=$PATH:$ORACLE_HOME/bin:$OWBHOME/bin:/ASW/ora_script:/local/bstat:/usr/bin:/opt/bin:/usr/local/bin; export PATH
/JZ -
Hi
All,
I have oracle 9i and 10g on unix. now i have 920.env and 1020.en file to set p respective enviornment.
when I excecute this commnad
. $HOME/920.env from the shell prompt it is working fine. and also same for 1020.env .
Now same command . $HOME/920.env i am putting in shell script and trying to execute that script but it is not executing.
i don't know what to do.
Thank you
vishalnow as i understand that statement is executing but it's scope is only with in the script. when it complete it's execution all varialble reset to it's by defualt .profile so that statement in the script set variable with in the scope of the script only.
Thanks for your help
Vishal -
Connect internal in shell script not working
Oracle: 11.2.0.1 in AIX env
I export ORACLE_SID and then try to connect internal but I get connected to idle instance. What am I missing???
this block is in a .sh script
export ORACLE_SID=ufms203
$ORACLE_HOME/bin/sqlplus /nolog <<EOF
connect / as sysdba
WHENEVER SQLERROR EXIT;
select instance_name from v$instance;
OUTPUT *********************
SQL*Plus: Release 11.2.0.1.0 Production on Tue Mar 29 09:43:05 2011
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL> Connected to an idle instance.
SQL> SQL> SQL> select instance_name from v
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0
DisconnectedThe instance is started:
k801ora@jd1su143 in /a0143/d01/scripts : ps -ef | grep ufms203
k801ora 8794340 1 0 12:32:46 - 0:00 oracleufms203 (LOCAL=NO)
k801ora 8929434 1 0 09:33:52 - 0:00 ora_w001_ufms203
k801ora 10248348 1 0 Mar 22 - 2:24 ora_pmon_ufms203
k801ora 10359024 1 0 Mar 22 - 0:15 ora_gen0_ufms203
k801ora 10379478 1 0 Mar 22 - 7:50 ora_vktm_ufms203
k801ora 10399748 1 0 Mar 22 - 0:40 ora_dbw0_ufms203
k801ora 10408158 1 0 Mar 22 - 1:19 ora_psp0_ufms203
k801ora 10420478 1 0 Mar 22 - 0:16 ora_mman_ufms203
k801ora 10428426 1 0 Mar 22 - 0:16 ora_diag_ufms203
k801ora 10436840 1 0 Mar 22 - 0:17 ora_dbrm_ufms203
k801ora 10440938 1 0 Mar 22 - 12:00 ora_dia0_ufms203
k801ora 10445048 1 0 Mar 22 - 2:51 ora_ckpt_ufms203
k801ora 10449134 1 0 Mar 22 - 0:38 ora_dbw1_ufms203
k801ora 10453232 1 0 Mar 22 - 0:35 ora_dbw2_ufms203
k801ora 10457330 1 0 Mar 22 - 0:35 ora_dbw3_ufms203
k801ora 10461428 1 0 Mar 22 - 0:47 ora_lgwr_ufms203
k801ora 10465530 1 0 Mar 22 - 0:04 ora_reco_ufms203
k801ora 10469624 1 0 Mar 22 - 0:55 ora_smon_ufms203
k801ora 10473726 1 0 Mar 22 - 4:42 ora_mmnl_ufms203
k801ora 10477820 1 0 Mar 22 - 2:43 ora_mmon_ufms203
k801ora 10485770 1 0 Mar 22 - 0:08 ora_q002_ufms203
k801ora 10489864 1 0 Mar 22 - 0:07 ora_qmnc_ufms203
k801ora 10506270 1 0 Mar 22 - 0:04 ora_q000_ufms203
k801ora 10530842 1 0 Mar 22 - 0:04 ora_q001_ufms203
k801ora 10588214 1 0 Mar 22 - 0:19 ora_smco_ufms203
k801ora 11124888 10510484 2 09:54:04 pts/0 0:00 grep ufms203
k801ora 11796592 1 0 09:35:19 - 0:00 ora_w000_ufms203
k801ora 12431386 1 0 09:53:53 - 0:00 ora_w002_ufms203
k801ora 12484794 1 0 12:32:41 - 0:11 oracleufms203 (LOCAL=NO)
k801ora 16023576 1 0 12:32:04 - 1:12 oracleufms203 (LOCAL=NO)
k801ora 16629976 1 0 09:25:21 - 0:00 ora_w005_ufms203 -
Creating user account and setting password in Solaris9 through shell script
I need to create and set password of user through shell scripts.
User can be added successfully through "useradd" command but password cant be set through "passwd" command in script.
Is there any other alternative for the same.Hi,
Did you get the answere for this ? I have the same problem as urs , like I want to creat the users by using useradd and want to hardcode there password in one script.
But I cant use expect utility which would have made my work easier -
Passwords, auto-fill in safari does not work it is enabled in settings, what can do
passwords, auto-fill in safari does not work it is enabled in settings, what can do
Private Browsing Off.
Private Browsing On. -
Change password on the first use - does not work
Change password on the first use - does not work.
Created a user and specified 'Change password on the first use' - when user logs in - the 'Change password' window does not pop- up.
Please advise.(APEX 4.0.2) I am running into this same issue - if you don't set the password expiration and locking to 'Yes', the user gets into the app without being asked to change the pw.
When you do set expiration and locking - after the user logs on with their temporary password, it does take them to the change password page (4155:50) but the username is blank. Because the username didn't get to the page the old password will never match and you get the "Invalid password" message.
What am I missing? Anyone successful doing this?
Simple application, default authentication, no javascript, HTTP_SERVER, no ssl.
Thanks,
Steve -
On my Mac Book Pro My password at the start up is not working on restart
Hi
My password at the start up is not working on restart
But if i close the cover and re-open it he ask for my passwordChanging or resetting an account password
-
HT5621 I can't remember my password and my yahoo mail is not working and I can't open my store
I can't remember my password and my yahoo mail is not working and I can't open my store
What do you mean your Yahoo mail isn;t working? If you are talking about it not working in the mail app, remove your account from Settings > Mail, Contacts, Calendars and add it again. Then follow the instructions here to recover your Apple ID password.
-
Modify shell script to work with other folders
i am trying to modify a shell script that sorts files in a course folder into sub folders by month. I have a shell script that works, but when i try to modify it for another course folder it quits working. can someone let me know what i am doing wrong?
the working shell script:
do shell script "
for f in \"$HOME/Desktop/DWI Annual Report/\"*
do if [ ! -d \"$f\" ]; then
x=\"${f%%.*}\"
i=$((${#x}-3))
if [ -d \"$HOME/Desktop/DWI monthly/${f:$i:3}\" ]; then
mv \"$f\" \"$HOME/Desktop/DWI monthly/${f:$i:3}\"
fi
fi
done"
the nonworking modified script:
do shell script "
for f in \"$HOME/Desktop/DOEP Annual Report/\"*
do
if [ ! -d \"$f\" ]; then
x=\"${f%%.*}\"
i=$((${#x}-3))
if [ -d \"$HOME/Desktop/DOEP monthly/${f:$i:3}\" ]; then
mv \"$f\" \"$HOME/Desktop/DOEP monthly/${f:$i:3}\"
fi
fi
done"ok here is the applescript that works.
property total_student : 1
tell application "Finder"
set master_path to alias "Users:macbook:Desktop:DWI Annual Report:Annual Report.xlsx"
set filesWithDWI to get every file of folder ((path to desktop folder) & "DWI Annual Report" as string) whose name contains "DWI"
repeat with f in filesWithDWI
my transfer_data(f, master_path)
end repeat
end tell
on transfer_data(child_path, master_path)
tell application "Microsoft Excel"
set child_book to (open workbook workbook file name (child_path as string))
set child_doc to worksheet 1 of child_book
set master to worksheet "sheet 1" of (open workbook workbook file name (master_path as string))
set num to 15 --All lists start at index 12 or later, I'm putting 10 to be safe
set students to {}
tell child_doc --grab values from child document
repeat until (value of cell (("A" & num) as string)) is 1
set num to num + 1
end repeat
repeat until (value of cell (("B" & num) as string)) is ""
set end of students to {namevalue of cell (("B" & num) as string)), driver_idvalue of cell (("C" & num) as string)), DOBvalue of cell (("D" & num) as string)), Ref_Recvalue of cell (("I" & num) as string)), pre_testvalue of cell (("J" & num) as string)), post_testvalue of cell (("K" & num) as string)), cert_idvalue of cell (("L" & num) as string))}
set num to num + 1
end repeat
set startdate to range "C7"
set classlocation to range "C11"
set instructor to range "H7"
end tell
tell master
set num to 7
log (value of cell (("B" & num) as string))
repeat until (value of cell (("B" & num) as string)) is ""
set num to num + 1
end repeat
repeat with student in students
set value of cell (("A" & num) as string) to total_student
set value of cell (("B" & num) as string) to name of student
set value of cell (("C" & num) as string) to driver_id of student
set value of cell (("D" & num) as string) to DOB of student
set value of cell (("H" & num) as string) to pre_test of student
set value of cell (("I" & num) as string) to post_test of student
set value of cell (("J" & num) as string) to cert_id of student
set value of cell (("f" & num) as string) to startdate
set value of cell (("E" & num) as string) to classlocation
set value of cell (("G" & num) as string) to instructor
set value of cell (("K" & num) as string) to Ref_Rec of student
set num to num + 1
set total_student to total_student + 1
end repeat
end tell
save child_book
close child_book
save active workbook in master_path
close active workbook
end tell
end transfer_data
do shell script "
for f in \"$HOME/Desktop/DWI Annual Report/\"*
do
if [ ! -d \"$f\" ]; then
x=\"${f%%.*}\"
i=$((${#x}-3))
if [ -d \"$HOME/Desktop/DWI monthly/${f:$i:3}\" ]; then
mv \"$f\" \"$HOME/Desktop/DWI monthly/${f:$i:3}\"
fi
fi
done"
It takes the class rosters and copies the information from the class roster to the annual report and then moves the file to the monthly folder and files it in the appropriate months folder based on the last three letters of the file name. -
Sql Loader by using shell script, not able to insert data
Hi,
I am trying to dump the data by using shell script.(in shell script i am having sqlldr command)(its a host excutable method cocurrent program)
When i am loading the data, by placing my files(.ctl,.prog,.csv,symbolink file for .prog) in $Custom_top/bin, it is loading exactly. 17000 records inserted.
But if i am loading the data by placing my files in $custom_top/custom_folders. unable to insert total data. only 43 records inserting.
Please any one can help me.
Thanks in advance.
Rama.Srini, Thanks a lot for ur reply,
Oracle Apps version R12,
Microsoft windows XP profissional
Version 2002 service Pack 3
My Control file Script is:
load data
infile '$XADP_TOP/data/CPIU/in/XXOKS_Price_Increase.csv'
append
into table XXOKS_CONTRACT_PRICE_INCR_DTLS
fields terminated BY ',' optionally enclosed by '"'
TRAILING NULLCOLS
(EXCLUSION_FLAG,
LEGACY_NUMBER,
CUSTOMER_NUMBER,
CUSTOMER_NAME,
REQUEST_ID,
CONTRACT_NUMBER,
CONTRACT_START_DATE,
CONTRACT_END,
REQUEST_LINE_ID,
LINE_START_DATE,
LINE_END_DATE,
ITEM_NUMBER,
ITEM_DESCRIPTION,
UNIT_PRICE,
QTY,
NEW_UNIT_PRICE,
LINE_AMOUNT,
NEW_LINE_AMOUNT,
PRICE_INCREASED_DATE,
PERCENTAGE_INCREASED,
ORIGINAL_CONTRACT_AMOUNT,
NEW_CONTRACT_AMOUNT,
PRICE_INCREASE_AMOUNT)
My .prog File is: Please fidn that i created symbolink file also for my .prog.
if [ -z $XADP_TOP ];then
echo "XADP_TOP environment variable is not set!"
exit 1
fi
cd $XADP_TOP/data/CPIU/in
DATE=`date +%y%m%d:%H%M`
i_program_name="$0"
i_ora_pwd="$1"
i_user_id="$2"
i_user_name="$3"
i_request_id="$4"
i_ftp_host_name="$5"
i_ftp_user_name="$6"
i_ftp_user_password="$7"
ftp_prog() {
# FTP Function to reuse the FTP Commands
if [ $# -ne 6 ];then
echo "Usage : ftp_prog <Hostname> <User name> <Password> <Remote Directory> <command> <filename>"
exit 2
fi
l_ftp_host_name="$1"
l_ftp_user_name="$2"
l_ftp_user_password="$3"
l_ftpdir="$4"
l_ftp_command="$5"
l_ftp_filename="$6"
ftp -v -n ${l_ftp_host_name} <<EOF
user ${l_ftp_user_name} ${l_ftp_user_password}
ascii
cd ${l_ftpdir}
${l_ftp_command} ${l_ftp_filename}
quit
EOF
#exit $?
# setting the ftp directory
#ftpdir="/`echo ${TWO_TASK:-$ORACLE_SID}|tr "[A-Z]" "[a-z]"`/CPIU"
##ftpdir="/FinTEST/quoting/PS/ar"
ftpdir="$XADP_TOP/data/CPIU/in"
# setting the in directory and out directory
indir="$XADP_TOP/data/CPIU/in"
outdir="$XADP_TOP/data/CPIU/out"
ftp_prog ${i_ftp_host_name} ${i_ftp_user_name} ${i_ftp_user_password} ${ftpdir} get XXOKS_Price_Increase.csv
echo $ftpdir
echo "Converting the data file into unix mode"
dos2unix XXOKS_Price_Increase.csv XXOKS_Price_Increase.csv
chmod 777 XXOKS_Price_Increase.csv
cd $XADP_TOP/bin
echo "Trying to excute sqlldr and entering into the into control file"
$ORACLE_HOME/bin/sqlldr userid=$i_ora_pwd control=XXOKS_PRICE_INCR_LOAD log=$XADP_TOP/log/XXOKS_PRICE_INCR_LOAD_${DATE}.log;
exit_status=$?
echo "Checking the status and giving permissions to the data file which in in dir"
if [ $exit_status -eq 0 ]; then
cd $XADP_TOP/data/CPIU/in
chmod 777 XXOKS_Price_Increase.csv
echo "try to move data file into out dir"
# Moving the file to out directory
mv XXOKS_Price_Increase.csv ${outdir}/XXOKS_Price_Increase.csv_${DATE}
#echo "ready to zip file in out dir step6"
# Zipping the file
#gzip -f ${outdir}/XXOKS_Price_Increase.csv_${DATE}
echo "deleting the file which is in dir"
# Deleting the file from in directory
/bin/rm -f ${indir}/XXOKS_Price_Increase.csv
# Deleting from the remote directory
ftp_prog ${i_ftp_host_name} ${i_ftp_user_name} ${i_ftp_user_password} ${ftpdir} delete XXOKS_Price_Increase.csv
echo "sqlloader finished successfully."
else
echo "Error in loader"
##echo "Loader error in Price Increase Detials File ${i_file}"
fi
exit $exit_status
And My Log file Comments are
SQL*Loader: Release 10.1.0.5.0 - Production on Thu Dec 3 01:32:08 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Control File: XXOKS_PRICE_INCR_LOAD.ctl
Data File: /oesapp/applmgr/GIS11/apps/apps_st/appl/xadp/12.0.0/data/CPIU/in/XXOKS_Price_Increase.csv
Bad File: XXOKS_Price_Increase.bad
Discard File: none specified
(Allow all discards)
Number to load: ALL
Number to skip: 0
Errors allowed: 50
Bind array: 64 rows, maximum of 256000 bytes
Continuation: none specified
Path used: Conventional
Table XXOKS_CONTRACT_PRICE_INCR_DTLS, loaded from every logical record.
Insert option in effect for this table: APPEND
TRAILING NULLCOLS option in effect
Column Name Position Len Term Encl Datatype
EXCLUSION_FLAG FIRST * , O(") CHARACTER
LEGACY_NUMBER NEXT * , O(") CHARACTER
CUSTOMER_NUMBER NEXT * , O(") CHARACTER
CUSTOMER_NAME NEXT * , O(") CHARACTER
REQUEST_ID NEXT * , O(") CHARACTER
CONTRACT_NUMBER NEXT * , O(") CHARACTER
CONTRACT_START_DATE NEXT * , O(") CHARACTER
CONTRACT_END NEXT * , O(") CHARACTER
REQUEST_LINE_ID NEXT * , O(") CHARACTER
LINE_START_DATE NEXT * , O(") CHARACTER
LINE_END_DATE NEXT * , O(") CHARACTER
ITEM_NUMBER NEXT * , O(") CHARACTER
ITEM_DESCRIPTION NEXT * , O(") CHARACTER
UNIT_PRICE NEXT * , O(") CHARACTER
QTY NEXT * , O(") CHARACTER
NEW_UNIT_PRICE NEXT * , O(") CHARACTER
LINE_AMOUNT NEXT * , O(") CHARACTER
NEW_LINE_AMOUNT NEXT * , O(") CHARACTER
PRICE_INCREASED_DATE NEXT * , O(") CHARACTER
PERCENTAGE_INCREASED NEXT * , O(") CHARACTER
ORIGINAL_CONTRACT_AMOUNT NEXT * , O(") CHARACTER
NEW_CONTRACT_AMOUNT NEXT * , O(") CHARACTER
PRICE_INCREASE_AMOUNT NEXT * , O(") CHARACTER
value used for ROWS parameter changed from 64 to 43
Table XXOKS_CONTRACT_PRICE_INCR_DTLS:
43 Rows successfully loaded.
0 Rows not loaded due to data errors.
0 Rows not loaded because all WHEN clauses were failed.
0 Rows not loaded because all fields were null.
Space allocated for bind array: 255162 bytes(43 rows)
Read buffer bytes: 1048576
Total logical records skipped: 0
Total logical records read: 43
Total logical records rejected: 0
Total logical records discarded: 0
Run began on Thu Dec 03 01:32:08 2009
Run ended on Thu Dec 03 01:32:08 2009
Elapsed time was: 00:00:00.19
CPU time was: 00:00:00.04
Plz srini help me.
Thanks in advance
Rama.. -
Shell Script not getting invoked in File adapter
Hi all,
Requirement:
PI need to pick the file from source directory and send it to target directory using SFTP.
I'm using SCP command for this purpose.
When I run the shell script (with simple SCP command) from command prompt, script is working fine.
Same script is called from PI File adapter but script is not getting invoked.
In the communication channel logs, "Executed OS command" is available. There are no Error/Warning messages in the log.
NFS transport protocol is used in the File communication channel.
Complete directory path of the shell script is mentioned in File channel -> Run Operating System command after message processing.
Even the following simple command is not working from PI receiver file channel:
echo "Test file" >> /data/test.txt
Please let me know if I'm missing out something.
Thanks,
GeethaHi Geetha,
I think the syntax u are using is not correct. Please follow the below syntax:
/path/<script_name> %F
for ex: /staging/Interface/XI/Script/FTPData %F
use the above in the communication channel.
%F should be after a space.
FTPData is the script name
/staging/Interface/XI/Script/ is the location where the script is present
Cheers,
Souvik
Edited by: Souvik Chatterjee on Apr 14, 2011 3:38 PM -
Automator: current directory in shell script not accepted
Hi!
I wrote a bash script requiring first the directory where the script is.
#!/bin/bash
cd "`dirname \"$0\"`"
convert *_A.jpg *_N21.jpg *_I3.jpg -background black -compose screen -flatten merge.jpg
exit
The script runs fine itself. I want to integrate this as an Automator's service, right-clicking on random image and starting the script in THAT directory.
Unfortunately, cd "`dirname \"$0\"`" doesn't seem to work when built in automator and Home directory is always default.
I also tried in automator with this http://img84.imageshack.us/img84/9317/schermata20100605a00251.png (sorry it's italian,below a translation)
Folders in Finder
1)Obtain specified items from Finder: Path
2)Shell script
#!/bin/bash
cd $@
convert *_A.jpg *_N21.jpg *_I3.jpg -background black -compose screen -flatten merge.jpg
exit
and fails too.
All solutions will be appreciated
Thanks
StefanoTry the Unix forum under OS X Technologies for bash scripting and these for automator stuff:
http://www.macosxautomation.com/
Introduction to Automator tutorial at http://automator.us/leopard/video/index.html
http://www.automatedworkflows.com/tips/podcast.html and
http://www.macosxautomation.com/automator/examples/ex04/index.html
and finally the Automator forum under OS X Leopard. -
LoginHook Shell Script not running?
I have a very simple login shell script (open http://pathtowebsite.local) that I have set as a LoginHook. When running the script from the Terminal, it opens the website, as expected. However, on login it appears that something happens, the menu bar flashes and disappears until you click on something, but the website doesn't open. The permissions are set properly, and it is executable. The script is located in the global /Library folder in a folder I created called Management, though I also tried putting it in the /Users/Shared directory in case it was an access issue.
Any ideas on what I might do to resolve this issue? I can't seem to get it to actually kick off at user login like it should.The LoginHook environment is minimum. There is NO PATH
pwd: /
id -a: uid=0(root)
gid=0(wheel)
egid=80(admin)
groups=0(wheel),
1(daemon),
2(kmem),
8(procview),
29(certusers),
3(sys),
9(procmod),
4(tty),
5(operator),
80(admin),
20(staff)
$1: thelogin_person'susername
printenv:
PWD=/
SHLVL=1
SECURITYSESSIONID=449a3aa0
_=/usr/bin/printenv
Notice, no PATH, no USER environment variables, just about nothing as an environment.
So there is no way for the LoginHook to find the 'open' command.
Try changing your script to /usr/bin/open
Maybe you are looking for
-
How do I install Tiger on a G3 iMAC from an external DVD drive?
I want to install Tiger on my PPC G3 iMAC. It is 500MHZ with 512 MB Ram, running 10.3.9. It has a CD drive, but CD version of Tiger is no longer available. I purchased a retail version of Tiger, and, on the advice of the Apple Store personnel, purcha
-
How can we bug Apple to enable temp readouts?
I've read somewhere that Apple has said that they will enable temperature readings in the new Macbook Pros if there is enough interest. How can I express my interest to them?
-
Connection failed on report builder 2.0
Hi, i use report builder 2.0 connect to the server by using http://servername/reportserver, it came out an error Unable connect to the server that is specified in the URL, make sure http://servername/reportserver, make sure server is running, URL is
-
I recent recieved and Ipod touch model A1213 and i cannot figure out how to get apps on it. I have tried everything i can think of and when i try to update my ipod software it tells me that its already up to date. even though its only 1.1.5. How do i
-
Portal Runtime Error --- Portal content is not opening
Hello Experts, While logging to the system we are getting this message Portal Runtime Error An exception occurred while processing a request for : iView : pcd:portal_content/every_user/general/defaultDesktop/frameworkPages/frameworkpage/com.sap.porta