MacMini backup from unix shell
I have setup a MacMini as a web server, and the only way I can get to it is with SSH.
I am trying to setup a cron job to do backups to an external hard drive, but I am having some dificulty finding out what some of the best practices are. Since I do not have a GUI, what utilities are out there to help me back up the system?
I want, in case of a failure, to be able to restore the full OS, with the boot record and everything.
The tar did not allow me to go over 4BG or space... (plus it does not do the MBR)
MacMini
MacMini
IF you need more help with rsync, you should move this discussion into the Unix forum. The guys over there know the command quite well.
Mac's rsync is a little different than the standard Linux flavor, because it makes allowances for the HFS+ format.
Here's the command I use (it runs nightly as a cron job)
rsync -a -c --exclude-from=/etc/rsyncx/exclude.conf /Users /private/etc /var/mail /var/ldap /Volumes/Backup > ~mainuser/rsyncx.log
This command backs up the Users, etc, var/mail, and var/ldap directories to /Volumes/Backup. Any problems are recorded in rsyncx.log in mainuser's home directory.
I use the exclude.conf file to skip things like cache files and other detritus that doesn't need to be saved. It's just a plain text file with these lines (note the "NoArchive/" -- anytime I have stuff I don't want archived, I just create a folder named "NoArchive" anywhere I want; anything in there won't get backed up):
Caches/
Cache/
caches/
cache/
Library/Thunderbird/
Library/Syndication/Database*
Library/Application Support/SyncServices/
Library/Application Support/Firefox/
Library/Application Support/Quicksilver/
Library/Preferences/MS Internet Cache/
SyncServices/
.spamassassin/bayes*
.razor/*log
.procmail/log
NoArchive/
.spumux/
.cpan/
.Trash/
Fonts/
iPhoto Library/
iTunes/
*.band/
.emlx
*.qsindex
*cache
Similar Messages
-
Calling a report from unix shell script
Hi,
I had to call a report from unix shell script.
May i know the procedure to accomplish this
Thanks in Advance
A.GopalFirst you should not include the whole path to your report in the call ...
Use like this:
/ora/u01/oracle/v101/as2/bin/rwrun.sh report=an_stati destype=file desname=/ora/u01/oracle/v101/as2/test.pdf desformat=pdf
In $ORACLE_HOME/bin/reports.sh:
1) Verify that you have updated the REPORTS_PATH variable to include your folder where you have the report in question
REPORTS_PATH=/ora/u20/app/qits/env1/run:$ORACLE_HOME/reports/templates:$ORACLE_HOME/reports/samples/demo: ....
2) Verify that the REPORTS_TMP variable is pointing to a valid location and that the oracle user has access to write on it.
After that, post the content of the tracefile located at $ORACLE_HOME/reports/logs/{in-process report server name folder}/rwserver.trc
If no file is present then it means that you need to enable trace in your reports's conf file.... go to the $ORACLE_HOME/reports/conf folder and and locate the .conf file that correspond to your in-process reports server name (as specified in the rwservelet.properties file)... open/edit the file to enable trace logs ..
i.e.
Change the following line:
<!--trace traceOpts="trace_all"/-->
to <trace traceOpts="trace_all"/>
Bounce the reports server and try to run the report again, this time the .trc file should be generated, post the content so that we can take a look. -
Calling stored procedure from unix shell script
Hello,
I am facing a problem while calling a stored procedure from UNIX shell script. I want to return a output variable from the stored procedure to the UNIX environment.
Here is the code-
#!/bin/sh
OUTPUT=`sqlplus cmag/magnum@dw <<ENDOFSQL
set serveroutput on;
var prd_out varchar2(100);
exec create_pm_window(:prd_out);
exit;
ENDOFSQL`
echo " output is - $OUTPUT"
The problem is :prd_out is not getting copied to shell variable OUTPUT.
I have a dbms_output.put_line in the stored proc create_pm_window and I can see that prd_out is getting populated.
Any help is really appreciated.
Thanks'
RakheeFirst step :
make sure the PL/SQL works as expected.
Does the following display the expected output executed from SQL*Plus ?
set serverout on
declare
prd_out varchar2(100);
begin
create_pm_window(prd_out);
dbms_output.put_line('output is '||prd_out);
end;
I don't have your procedure, but using a dummy procedure like :
Scott@my10g SQL>create procedure foo(p_out in out varchar2)
2 is
3 begin
4 select 'Hello '||instance_name into p_out from v$instance;
5 end;
6 /
Procedure created. and a toto.sh script as :OUTPUT=`sqlplus -s scott/tiger <<EOF
set pages 0 lines 120 trimout on trimspool on tab off echo off verify off feed off serverout on
var mavar varchar2(100);
exec foo(:mavar);
print mavar;
exit;
EOF`
echo "OUT = ${OUTPUT}"
exitIt works fine :[oracle@Nicosa-oel ~]$ ./toto.sh
OUT = Hello my10g -
Return codes from sqlldr command from unix shell script
I am trying to capture error code from sql loader from unix shell script and display proper messages.
sqlldr parfile=sdb.par control=$cntlfile data=$infile bad=$badFile log=$logFile rows=10000
rows=10000
retcode=`echo $?`
case "$retcode" in
0) echo "SQL*Loader execution successful" ;;
1) echo "SQL*Loader execution exited with EX_FAIL, see logfile" ;;
2) echo "SQL*Loader execution exited with EX_WARN, see logfile" ;;
3) echo "SQL*Loader execution encountered a fatal error" ;;
*) echo "unknown return code";;
esac
Eventhough, there are errors while executing sqlldr, it is always returing recode zero. What could be the possible reason
Please adviceIs there a typo in your code ?
sqlldr parfile=sdb.par control=$cntlfile data=$infile bad=$badFile log=$logFile rows=10000
rows=10000
retcode=`echo $?` In this code, you get the return code of the statement in bold which is not the sqlldr statement ... -
Running stored procedure from unix shell
Hi
I have a stored procedure proc1 stored in a file, code1.txt in my home directory /home/user. How do i execute this file which contains the stored procedure from unix shell? I would really appreciate it if somebody gives me the complete shell script to accomplish the above task.
Thanks.To put everything together into a single posting:
The EXEC command is a SQL*Plus macro command. It is not a SQL or PL/SQL command.
The only way to execute a stored proc from a client, is to wrap the call in an anonymous PL/SQL block. I.e you need a BEGIN and END PL/SQL wrapper around the call.
E.g.BEGIN
-- calling a stored proc to start leave processing
scott.StartLeaveProcessing;
END;The EXEC macro in SQL*Plus does this automatically for you. Thus less typing. But do not confuse this command with the PL/SQL language.
Second issue. Use bind variables when making calls from clients. And not just for SQL statements, but also for PL/SQL. Unfortuantely this tends to be a hack in SQL*Plus due to the way SQL*Plus itself treats its bind variable assignments. But in principle, this is what you should do when calling an Oracle stored proc from a client:
SQL> -- define a host variable
SQL> var EMPID varchar2(100)
SQL> var FROM_DEPT number
SQL> var TO_DEDPT number;
SQL>
SQL> -- assign values to these (this is where SQL*Plus hacks it)
SQL> exec :EMPID := 100;
SQL> exec :FROM_DEPT := 1;
SQL> exec :TO_DEPT := 2;
SQL>
SQL> -- now make the stored proc call for moving employee 100 from
SQL> -- department 1 to department 2
SQL> EXEC scott.EmployeeTransfer( :EMPID, :FROM_DEPT, :TO_DEPT );
SQL>To do this from a Unix shell script:
#!/bin/bash
# environment variables
# --> put environment such as ORACLE_HOME, ORACLE_SID, TWO_TASK
# etc. here <--
# redirect STDIN from TTY (keyboard typewriter device) to the input from
# this file - which means SQL*Plus will not read from the keyboard but read
# from this file its input until the EOF marker/text is encountered
sqlplus -s /nolog << EOF
connect scott/tiger
var EMPID varchar2(100)
var FROM_DEPT number
var TO_DEDPT number;
exec :EMPID := 100;
exec :FROM_DEPT := 1;
exec :TO_DEPT := 2;
exec scott.EmployeeTransfer( :EMPID, :FROM_DEPT, :TO_DEPT );
exit;
EOF
#eof -
Executing java from unix shell script
Hi, I am trying to execute java program from a unix shell script and the program has a command line parameter. I have tried in ways like
/opt/java1.4/bin/java CollExtractLoadProcess /home/inbox/archive/file_name
/opt/java1.4/bin/java CollExtractLoadProcess "/home/inbox/archive/file_name"
/opt/java1.4/bin/java CollExtractLoadProcess '/home/inbox/archive/file_name'
/opt/java1.4/bin/java CollExtractLoadProcess file_name
No matter how I execute it gives me the following error
Exception in thread "main" java.lang.ClassFormatError: CollExtractLoadProcess (C
ode segment has wrong length)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
3)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
Could someone please let me know what is the correct way of doing this?
Thanks.Sounds like you either have a corrupt class file or you're using an older version of the JVM to try to execute classe that were compiled for a newer version.
-
Execute stored procedure from Unix shell script
My current method of executing stored procedures (wpl_1 and wpl_2) from a unix shell script is as follows:
<<wpl.sh>>
sqlplus user/password @/home/oracle/scripts/wpl.sql
<<wpl.sql>>
set serveroutput on size 1000000
set timing on
execute wpl_1('0000010676','~')
execute wpl_2('0000010676','~')
execute wpl_1('0000010236','FIX')
execute wpl_2('0000010236','FIX')
exit
Question: Is it possible to combine the two scripts (unix and oracle) together?A little rusty on this, but this may work:
My current method of executing stored procedures
(wpl_1 and wpl_2) from a unix shell script is as
follows:
<<wpl.sh>>sqlplus user/password @/home/oracle/scripts/wpl.sql << EOF
set serveroutput on size 1000000
set timing on
execute wpl_1('0000010676','~')
execute wpl_2('0000010676','~')
execute wpl_1('0000010236','FIX')
execute wpl_2('0000010236','FIX')
exit
EOF
>
Question: Is it possible to combine the two scripts
(unix and oracle) together? -
Parameter transfer to tmloadcf from Unix shell script.
Hi.
I am using Tuxedo global transaction with database password encryption, so I replaced by ***** the database password in OPENINFO string of the TMS in the UBBCONFIG GROUP section.
As a result the password should be inserted manually when running tmloadcf.
Do you know how this password can be inserted from a Unix shell scripts?
I tried to use << or named pipe (mkfifo) but in both cases the tmloadcf remained stuck.
Thanks in advance for your help.
Amnon Katz.Amnon,
The C library function isatty() is used to determine if tmloadcf is
associated with a terminal. If isatty(0) returns 0, then the tmloadcf code
to prompt for a password will fail.
In some places in Tuxedo, there is functionality to allow reading a password
from an environment variable if the process requiring the password is not
associated with a terminal. However, this functionality is not available
for tmloadcf. If you have an active Tuxedo maintenance contract and the
functionalty of reading a database password from an environment variable
when tmloadcf is not run from a terminal is important to you, you may want
to file a support case and request that this functionality be added to
tmloadcf. Otherwise, you will have to run tmloadcf from a terminal.
Regards,
Ed
<Amnon Katz> wrote in message news:[email protected]..
Thanks Ed for your reply.
Do you know how tmloadcf identify that descriptor 0 is associated with a
terminal?
Is it possible to write some code that can emulates this situation?
Regards,
Amnon -
Running SQLPLUS from UNIX shell script
I'm not sure if this is the right forum, but...
How can I execute a sql file from inside the UNIX shell script, logging on to Oracle w/o supplying a UID/pwd? Normally, we log into UNIX using our own logon, then sudo as another user to login to Oracle. Now, I'm trying to create a UNIX shell script, where I'm already sudo'd as the UserID that logs into Oracle. I've tried the following, but can't get it to work. I'm a UNIX scripting noob. Any ideas?
example:
#! /usr/bin/ksh
sqlplus / \@test.sql << EOF
exit;
EOFI'm a UNIX scripting noob.In which case I feel obligated to point you at William Robertson's excellent article Database Shellscripts Considered Harmful. Save yourself a world of pain.
Cheers, APC -
How can i call a Stored Procedure procedure from Unix shell script
Hi All,
I want to call a Strored PL-SQL Procedure through Unix shell script.
Can any body help me with this.
Regards,
SaurabhI prefer a seperate script like the other poster mentioned. However, most shells can use a 'here' document as well ...
sqlplus uid/pwd <<END
exec myproc
exit
ENDRichard -
I am unable to set the classpath from unix shell script
) I am new to java, provide me the solution to my problem, as it is urgent
I am unable to execute shell script on unix machine, the code is given below:
Basically it is not setting the classpath
dbUpload .java is astand alone java program to retrieve the report instance statistics from crystal server
Created a jar file from dbUpload.java as
Jar �cvf dbUpload.jar dbUpload.class
Here is mycode(script.sh)
CLASSPATH=/u01/CrystalList/cecore.jar:${CLASSPATH}:
CLASSPATH=${CLASSPATH}:/u01/CrystalList/cereports.jar:
CLASSPATH=${CLASSPATH}:/u01/CrystalList/dbUpload.jar:
Export CLASSPATH
Echo ${CLASSPATH}
Java dbUploadvenkat123,
if the code you posted is the original code of your script - it has some misspellings. Please try this one - it works for me both on solaris and linux.
#! /bin/bash
CLASSPATH=/u01/CrystalList/cecore.jar:$CLASSPATH
CLASSPATH=$CLASSPATH:/u01/CrystalList/cereports.jar
CLASSPATH=$CLASSPATH:/u01/CrystalList/dbUpload.jar
export CLASSPATH
echo $CLASSPATH
java dbUpload -
I hope I'm not premature with this question--I have been doing searches and haven't found the answer yet. So if this is pretty basic stuff, I apologize.
I've been assigned to convert some rather old Informix applications to Oracle (10g2). The old informix forms where executed via bourne shell scripts and as you can imagine, were pure character based screens. Is there a way to launch the new Oracle forms from a bourne shell script? I'm afraid you're going to tell me that I have to convert completely over to a web based application...
DarrenYep. Then you just access them via a URL. Your unix server would take on the role of application server ( & / DB Server).
Good luck! Hopefully they're not too complex and are documented....
Steve -
Encode/Decode string from unix shell
Hi,
I am not sure I'm addressing my question properly, but simply I have a stream where I send commands to a shell and when these commands come back from the input stream they don't mean anything as shown below:
inc show int status | inc |1/7|1/17|1/19|1/^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H$atus | inc show int status | inc |1/7|1/17|1/19|1/1 ^H^H^H^H^H^H^H^H^H8|1/6|1/8^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H show int status | inc |1/7|1/17|1/19|1/18|1/6|1/8| ^H^H^H^H^H^H^H^H^H1/16|1/15^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^Hstatus | inc |1/7|1/17|1/19|1/18|1/6|1/8|1/16|1/15| ^H^H^H^H^H^H^H^H^H1/13|1/14^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^Hnc |1/7|1/17|1/19|1/18|1/6|1/8|1/16|1/15|1/13|1/14| ^H^H^H^H^H^H^H^H^H1/12|1/11^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H17|1/19|1/18|1/6|1/8|1/16|1/15|1/13|1/14|1/12|1/11| ^H^H^H^H^H^H^H^H^H1/9|1/10
I am using the utf-8 for encoding...do I need to decode it and how?
Here is part of my code:
OutputStreamWriter writer = new OutputStreamWriter(sess.getStdin(), "utf-8");
writer.write("my string");
writer.flush();
class StreamGobbler implements Runnable {
InputStream is;
OutputStream oi;
String type;
ResultBean resultBean;
StreamGobbler(InputStream is, String type, ResultBean returnValue) {
this.is = is;
this.type = type;
this.resultBean = returnValue;
@Override
public void run() {
try {
InputStreamReader isr = new InputStreamReader(is, "UTF-8");
BufferedReader br = new BufferedReader(isr);
String line = null;
while ((line = br.readLine()) != null) {
//System.out.println("TYPE[" + type + "] COMES FROM STD_OUT THREAD: " + line);
this.resultBean.addResultLine(line);
this.resultBean.addMessage(line);
} catch (IOException ioe) {
System.out.println("IOE Exception in StreamGobbler");
ioe.printStackTrace();
}Thanks in advance, i never dealt with encoding/decoding text.kminev wrote:
I am pretty sure it is an encoding issue, I'm not convinced because ^H is the ASCII backspace character. Maybe not as I originally thought just some padding but it looks like some form of formatting done the old fashioned way using control characters.
because if I also send this output in an email format and the email renders it a bit differently, then if I copy and paste the text to html page and render it on the screen it look as it is suppose to be.It's definitely not HTML so this does not seem logical.
>
Here are the ios commands I am issuing:
show int status | inc |gi1/2|gi1/3|gi1/5
then I send an empty string to the shell so if there is more prompt I see all the outputted values.
Does that help in any way?
ThanksSorry I can't help.
Bye -
Calling sqlplus from unix shell script
Hi All,
I am executing the following code :-
sqlplus -s ${DATABASE_USER} |&
print -p -- 'set feed off pause off pages 0 head off veri off line 500'
print -p -- 'set term off time off serveroutput on size 1000000'
print -p -- "set sqlprompt ''"
print -p -- "SELECT run_command from tmp_run_batch where upper(batch_name) = upper('${PAR_PROGRAM_NAME}');"
read -p RUN_COMMAND
eval print -p -- \""execute dbms_output.put_line(${RUN_COMMAND});"\"
read -p RET_VAL
print -p -- "exit;"
The select stmt given above gives sample output as :-
pack_claims_clas_utils.func_main('$PAR_RUN_DATE','$PAR_RUN_LEVEL','$PAR_EXCLUSIVE_RUN_YN')
And then this package is executed.
The problem that I am facing is how to handle the no_data_found case of the select stmt. . When this case arises then the stmt. "read -p RUN_COMMAND" hangs.
Could you please provide any solution ?
Thanks
SudsHi,
Have you tried this:
# if [ -n means String has non-zero length
if [ -n $RUN_COMMAND ]
read -p RUN_COMMAND
fi
Hi All,
I am executing the following code :-
sqlplus -s ${DATABASE_USER} |&
print -p -- 'set feed off pause off pages 0 head off veri off line 500'
print -p -- 'set term off time off serveroutput on size 1000000'
print -p -- "set sqlprompt ''"
print -p -- "SELECT run_command from tmp_run_batch where upper(batch_name) = upper('${PAR_PROGRAM_NAME}');"
read -p RUN_COMMAND
eval print -p -- \""execute dbms_output.put_line(${RUN_COMMAND});"\"
read -p RET_VAL
print -p -- "exit;"
The select stmt given above gives sample output as :-
pack_claims_clas_utils.func_main('$PAR_RUN_DATE','$PAR_RUN_LEVEL','$PAR_EXCLUSIVE_RUN_YN')
And then this package is executed.
The problem that I am facing is how to handle the no_data_found case of the select stmt. . When this case arises then the stmt. "read -p RUN_COMMAND" hangs.
Could you please provide any solution ?
Thanks
Suds -
Passing Null Characters from Unix Shell Script to Java Program
Hi Experts,
Facing an issue with a shell script....
The shell script has 10 input parameters....
1st Parameter is a compiled Java program name(This can keep changing)
Rest 9 are the parameters of the Java Program...
The following piece of code is working when Test "a z" "b t" "" "" "" "" "" "" "" "" is hardcoded.
lv_java_string=`java Test "a z" "b t" "" "" "" "" "" "" "" ""`
The whole thing being dynamic.....
But when I dynamically populate the same on to a parameter lv_java_param and then execute the same
lv_java_string=`java $lv_java_param`
if i echo $lv_java_param its giving me Test "a z" "b t" "" "" "" "" "" "" "" "" correctly
Im facing some issue...... The issue is " is being treated as a parameter itself and the space between a and z is not taken into consideration and hence z is taken as the 2nd parameter
Issue seems to be something like the precedence in which the above statement is executed, because of which "s are calculated/manipulated. Is it something like
a) $lv_java_param is computed first and then java $lv_java_param
b) or java $lv_java_param is run on the fly......
Any help is much appreciated.This forum is about Oracle *RDBMS*
I don't see any question about Oracle RDBMS
Please find a forum about Java.
Sybrand Bakker
Senior Oracle DBA
Maybe you are looking for
-
My computer was shut down with live work still needing to be completed within an open tab of Firefox. The site that I was working from had not been bookmarked and a saved link back to the site had not been done yet either. After starting my laptop ba
-
How to hide video files in Playbook
I want to hide some of the videos to hide from my kids. There is no such option that any particular video file doesnt show in the videos list. Insted, if there is any option to hide the icon of the video from the menu, just like option in the Bold 4
-
Aperture 3 problems syncing to iPhone
I'm trying to sync "selected albums" from Aperture 3 in iTunes 9.0.3 and can't get the smart albums "In the last week" & "In the last month" to show any photos. They list 0 photos. Furthermore every time I sync, iTunes automatically unchecks the "In
-
Hi Gurus, I have an ABAP report, I would like to have the same report to be either converted to BEx report or as a web report. So that finally the user looks into the report through web as a web report that we do in BW. Please let me know....and any
-
Macbook Pro won't sleep when lid open
My 2011 Macbook Pro won't go to sleep if I leave the lid open. I have checked System Preferences>Energy Saver and the display/computer sleep is set to 10 min for both Battery and Power Adapter settings. Even if I close all the applications down, my c