I am currently customizing a shell script that is used to launch a database called OrientDb.
These are the relevant lines from the script in question:
sudo -u $ORIENTDB_USER sh -c "cd \"$ORIENTDB_DIR/bin\"; /usr/bin/nohup ./server.sh 1>../log/orientdb.log 2>../log/orientdb.err &"
sudo -u $ORIENTDB_USER sh -c "cd \"$ORIENTDB_DIR/bin\"; /usr/bin/nohup ./shutdown.sh 1>>../log/orientdb.log 2>>../log/orientdb.err &"
I understand that the script sudos to a user defined in ORIENTDB_USER and runs a few commands. I also understand that the & forces the script to run in the background.
However, when calling the server.sh and shutdown.sh scripts, it is appended with 1>../log/orient.err and 1>>../log/orientdb.err.
What does 1> and 1>> mean? What is the difference between the two?
1 > redirects stdout and writes it to a file named like the argument provided.
2 > would do the same for stderr.
1 >> does it but appends to a file instead of rewriting it, if it exists already.
| would pass the output to the next process.
Search for shell redirection if you want to know more.