What does "download or create" mean in a tofrodos context? - shell

I keep seeing this phrase "download or create" in tutorials right after tofrodos. What would be an example of how to download or create? I just get stuck in
^
^
^
mode.

apt-get -y install tofrodos
Download or create ZPX_ubuntu_12-04_auto_installer.sh
The author means you need to transfer the "ZPX_ubuntu_12-04_auto_installer.sh" shell script to the server, and if necessary, change to the directory you saved the script in using the cd command, before entering the commands below:
fromdos ZPX_ubuntu_12-04_auto_installer.sh
chmod +x ZPX_ubuntu_12-04_auto_installer.sh
./ZPX_ubuntu_12-04_auto_installer.sh
He seems to be referring to a particular script included in a .zip file posted on a web forum.
You may be able to download the .zip file to your computer, extract it, and then use the sftp or scp program to transfer just the shell script to the server. Alternatively, you could use wget or curl to download the .zip file to the server and then the unzip command to unzip it.
A graphical SFTP client like FileZilla may help for the former approach. The Firefox add-on cliget may help for the latter, especially because the file is hosted on a password-protected web forum.
fromdos is just a utility program to convert a text file from DOS/Windows format to Unix format by stripping out all the carriage return characters. Perhaps using this command is necessary because the author of the script used a Windows text editor or an ASCII-mode FTP transfer before zipping up the file. Of course, you need the file on the server if you are trying to run the command on the server.

Related

Need to create/delete text file in Unix box from windows

I have a requirement where i need to create and delete a text file on unix from my windows server where i have informatica installed.
Using workflow i was able to place file in unix but not able to find a way to delete already existing file.
Also the client does not want us to download any additional software like putty on windows server.
Please feel free to ask for more information if required.
if you are able to drop .sh (shell script) and execut it on unix then you can do that with "rmdir yourfolder" command, if you folder has andything under then you will need to use "rm -r yourfolder", if files inside the folder have any dependicies you need to use "rm -rf yourfolder".
Just make sure that you will navigate to the correct folder where you are deleting things.
Br, Aljaž.
Use Command Task in Informatica Workflow to invoke syntax mentioned by #Aljaz

Transfer file in Secure Shell

I use Secure Shell as a Chrome extension (https://chrome.google.com/webstore/detail/secure-shell/pnhechapfaindjhompbnflcldabbghjo?hl=da)
Now I have finished some programming and I need the file on my computer.
How can I transfer the file to my computer? Can I send it by email or something?
I have tried yanking all the lines in vim, but I still don't get it copied to my windows clipboard.
One entertaining (and moderately ridiculous) approach would be sprunge.
Run this on the remote machine:
cat myFile | curl -F 'sprunge=<-' http://sprunge.us
And then visit the URL it prints on your local machine. :D
I presume that you are using Windows OS and trying to download your file from a Linux like OS.
You use MobaXterm and it comes with a file transfer features.
http://mobaxterm.mobatek.net
On a CLI you can use "scp" to download and upload.
Another one is you can also use FileZilla using SFTP protocol

Winzip command line error and message handling

I'm trying to automatically zip a group of files and move them to a different location.
This is the command i'm using for the script:
<WinzipPath> -a -r -en <Dest&Name>.zip <source>
Problem is that at any given moment one of the files is still being written, and when i try to zip it i get the following message which interrupts my automation:
Any idea on how do I ignore\skip the message via CMD? tried looking in the Winzip's Doc for more flags but couldn't find anything helpful
Another (smaller) issue is that when zipping for the first time after installing I get this message:
Can I skip that as well?
Are you using WinZip or WinZip Command-line Add-on?
You will do much better when scripting to use WZZIP which is installed after installing the command-line Add-on in the WinZip folder. NOTE: You must have WinZip Professional installed first.
http://winzip.com/downcl.html
Better yet, if you have the option to use 7-zip.. Understand if you have to use WinZip, but 7-zip handles large archives and more files within an archive better (IMHO). Also, I have previously asked about 7-zip having the ability to move a file to file and the Developer of 7-zip did respond: https://stackoverflow.com/a/21209385/175063
Try adding -min
<WinzipPath> -min -a -r -en <Dest&Name>.zip <source>
So you minimise the user interface, and it should not show message windows

What DOS commands do I use to extract a tarball?

A friend sent me a tarball entitled cst-web.tar.gz
I am on a work computer that doesn't allow me to download files so I thought to extract the tarball using the DOS commands. However, when I use any of the DOS commands I found such as
tar xf [filename]
# or
tar -xvzf [filename]
I get the message that the command is 'not recognizable as an internal or external command, operable program or batch file'.
Stuck on what to try next. Any suggestions?
There is nothing built into Windows that can extract a tarball. You will need a third-party program like 7-Zip or WinRAR. If you can't download files, you can't open the tarball.

Why my Bash script won't even run if it is deployed in a web app?

I created this simple script that does a backup, I wrote and tested it in Linux, then I copied it in my WebApp WEB-INF/scripts directory so that I could be run via Java Runtime.exec().
#!/bin/bash
JACCISE_FOLDER="/var/jaccise"
rm $JACCISE_FOLDER/jaccisebackup.zip
zip -r jaccisefolder.zip $JACCISE_FOLDER
mysqldump -ujacc -pxxx jacciseweb > jaccisewebdump.sql
zip jaccisebackup.zip jaccisewebdump.sql
zip jaccisebackup.zip jaccisefolder.zip
rm jaccisewebdump.sql
rm jaccisefolder.zip
cp jaccisebackup.zip $JACCISE_FOLDER
But it doesn't. So I tried to copy it from WEB-INF/scripts to my user dir and run it to roubleshoot it. The result is that it comes out with: ": File o directory non esistente" (Means "Unknown file or directory" notice the colon at the beginning). I created another file from scratch, copied and pasted the whole script and it works. I may think that this is related to:
Text encoding
\n\r differences between windows (I use Eclipse on windows to edit everything) and Linux.
How do I solve this deploy problem?
You should check if the file is executable (chmod +x). Then you should check, if your web server allows the execution of external programs. This might be a security problem and it is likely that the web server prevents the execution. Check the logs of the web server. The encoding of the file can be changed with the dos2unix command. In order to debug your script you can add an "set -x" at the beginning, but I think the script does not start at all.

Resources