Server :: Passing On Command Line Switches To Other Programs?
Nov 10, 2010
On our server we have a certain directory, say /storage, that contains many large files. They are all compressed (gzip). Many of our users are not computer-savvy, and so when one of these files is needed, they will copy it to their own directory. Consequently, we have multiple terabytes of duplicate data. I'd like to enforce an alias whereby if someone tries to use cp on a file from /storage, they will instead create a symbolic link. My idea was something like:
alias cp='cp.storage'
File cp.storage:#!/bin/sh
truePath=$(readlink -f "$1")
[code]....
The conditional checks whether the file being copied begins with "/storage". The problem with this is that if someone wanted to use cp with any options on a file not in /storage, those options would be obliterated. Can someone guide me as to a good way to accomplish this? Either a way to get the options from cp into cp.storage, or another approach not using alias this way. Everyone will be using bash.
View 2 Replies
ADVERTISEMENT
May 6, 2011
I am very new to shell scripting.How does one pass a command-line parameter to a shell script?for the below program
#/bin/bash
mount -t cifs -o user=ramkannan,password=Linux123@ //10.200.1.125/ramkannan /MT
cd /MT/test
date=`/bin/date "+\%Y-\%m-\%d-\%H-\%M-\%S"`
mysqldump -uroot -pram2@ employeedb > $date.sql
gzip $date.sql
I want to pass parameter for everything,i tried in google and did but iam getting error while passing parameter to all
#/bin/bash
mount -t cifs -o user=$1,password=$2 //10.200.1.125/ramkannan /MT
cd /MT/test
date=`/bin/date "+\%Y-\%m-\%d-\%H-\%M-\%S"`
mysqldump -uroot -pram2@ employeedb > $date.sql
gzip $date.sql
i was getting error while passing parameter to all.
View 2 Replies
View Related
Oct 6, 2010
I am trying to encode files via mencoder. The file name has spaces in it. "test file.mkv". When I manually type the command in the terminal, everything works. But when I use a bash script (I'm reading it from a file) it doesn't. It gives me
Code:
File not found: '"test'
Below is the bash script I wrote
Code:
#!/bin/bash
# For testing, we have already built a file list, so just use that.
# ls *.mkv>files.lst
exec 10<files.lst
let count=0
while read -u 10 FILE; do
LINE="mencoder -of lavf -lavfopts format=mp4 -vf scale=1024:-3 -ovc x264 -x264encopts crf=28:vbv_maxrate=1500:nocabac:global_header:bframes=0 -oac faac -faacopts br=160:mpeg=4:object=2:raw -channels 2 -srate 48000 "$FILE" -o test.mp4"
echo $LINE
exec $LINE
done
exec 10>&-
files.lst contains only a single line (no newline) with
Code:
test file.mkv
On a related note, when I was first trying this simply on the command line, I had a file that had a double exclamation point. I found out that that is a shortcut of some kind for the previous command. My kludge to get around this was to try to execute a single exclamation point as a command, then to change the double exclamation point to a quadruple exclamation point. Is there a proper way (escape sequence or something) to pass double exclamation points to a command?
View 2 Replies
View Related
Jun 18, 2011
For whatever reason, the "Ctrl-Alt-Fn" sequence has no effect on one of my Ubuntu machines; the sequence is interpreted as ordinary input. I need to get the system to a console because I'm trying to do a dist-upgrade and that's going to bounce gdm etc.
Is there some command-line tool that can be used to switch consoles? I have some vague distant memory of that being possible.
(I'm running Ubunty Jaunty at the moment. Yes I know it's old; I'm trying to march forward.)
View 2 Replies
View Related
Aug 4, 2010
I am writing a script to get hardware information of a particular UNIX machine. To do this, I ftp a shell script (commands to get h/w information) to the target machine and then use SSH to remote the remote script.With FTP, I can pass a password accepted as input the shell script. How can I pass the same password to SSH ? This is because I do not want the user to enter the password twice.
View 5 Replies
View Related
Apr 2, 2011
how to pass an array as a command line argument in a shell script?
View 5 Replies
View Related
Jul 13, 2009
how to use QGLviewer. I want to give my program a file name as a command line argument. All of the sample programs I find have a main.cpp file like this:
Quote:
#include <QApplication>
#include "window.h"
int main(int argc, char *argv[])
[code]....
Then the Window class, which is derived from QGLViewer, does all the program's actual work. If I want access to argc and argv, for example, to open and read a file that's passed as an argument, what would handle that? Is there a built-in way to get the arg variables to the window class, or do I need to just write a loadfile function and pass them?
View 1 Replies
View Related
Sep 25, 2010
How do I find out which command line programs are installed and what do they do?
View 9 Replies
View Related
Aug 18, 2010
In Windows, if I have a console window open, type winmine, and press enter, Minesweeper will appear, completely separate from the cmd program. The Minesweeper instance is not tied to the command prompt in any way that I know of, with the exception of Minesweeper's parent being set to that instance of the command prompt. It's different in Linux, however.
In Linux, if I have a console window open, type emacs and press enter, Emacs will open, but it seems tied to the command line. Specifically, it appears that I can't use the command line anymore until that instance of Emacs is closed. Is there a way to replicate the Windows behavior in Linux?
View 11 Replies
View Related
Aug 23, 2010
I just started using ubuntu after being a long time windows user.
what i find really interesting is that in command line, i can type many programs and commands, eg firefox can be run via command line from anywhere. In windows cmd prompt, im used to having to run the .exe file by first navigating to it, then being able to run the .exe.
what i wanna know is how does linux know all the programs at the command line?
View 5 Replies
View Related
Oct 23, 2009
I'm trying to create a liveCD/USB for use of myself and my family. The idea is to set up the LiveCD to look like their used to seeing it. I know I can just copy the homedirectory but I wanted to do it via script so new user accounts could also have the common bells and whistles we use.So really I have two questions.1. Is it possible to add programs to the Gnome Tool Bar from command line? aka via a script2. Is it possible to modify the default panel template so new users get my changes?
View 1 Replies
View Related
Nov 12, 2009
I am not sure if that Subject really explains it, basically I have a script that executes a CLI java-applet that requires a passphrase from the user. I can easily execute this by issuing the -p argument followed by the passphrase however that shows up on possible logs or at least on the results of the ' ps ' command. If you do not supply this -p argument it provides a new line with the echo " Enter Passphrase: " and asks for input.
how can I provide a result/input for the Passphrase request and is it still possible to throw this application in the background with the ' & ' following the command? I have seen a few examples that show a /bin/expect that expects a result and sends a command however I would like to refrain from any extra dependencies. Example of Regular Execution of application:
Code:
$ /usr/local/***/**** -u USERNAME -r Default-Realm -f certificate.der
Password:
View 6 Replies
View Related
Mar 8, 2011
I'm trying to run a home radio server here, and when I run one of the programs.. It continues to run and I cant go back to type any other commands to finish the process. Is there a special key combination that'll get me back to to the command line without killing or stopping the process?
View 2 Replies
View Related
Jan 9, 2010
I purchased a foot pedal [URL], which I want to use as a substitute for the ALT, CTRL and SHIFT key (Mainly in my texteditor, Emacs, where these modifiers are used a lot for commands). So instead of pressing ALT+x I want to press the left pedal + x. However, instead of going into the command mode it just types x to the screen. If I keep the pedal pressed, and type another x, it switches into command mode, like it should have done right away. The device seems to use HID, and lsusb gives:
Bus 005 Device 004: ID 1130:660c Tenx Technology, Inc.
Is there a way, how I can change the behaviour of the device?
View 3 Replies
View Related
May 29, 2010
i've gotten my fedora 12 to the point where i can run python3 scripts from command line and can call up python 2.6.2 idle with the command 'idle' from command line. what command will call up python3 (3.1.2 to be exact) idle?
View 5 Replies
View Related
Apr 1, 2010
I was having so much trouble with ubuntu 8.04 that I deleted off my computer and did a fresh install of 9.10. I downloaded the 64 bit iso from the internet, burned it to a disc and installed it. When it asked if it should be the server version I thought I said no. Now when I boot it only boots to the server version and all I get is command line. Can I get out of this and get my regular ubuntu screen back or did I install the wrong version?
View 6 Replies
View Related
Jun 30, 2010
Whilst I have used GUI-based Linux distros for the last few years, I am now struggling somewhat when it comes to setting up a server from the command line. All the howto's I've read so far tell you how to set up certain things, but I don't know what I actually need to set up.Rather than asking the same questions all over again on a forum like this, and generally being a bit of a noob, I wonder if there's a resource somewhere that someone could direct me to in order to know what I need to do to set up a fileserver.
The hardware is all done, and I will probably set up a router distro like IpCop to manage the network, but I'm rather lost as to what packages I need, and how to know what the server is/isn't doing.I've used plenty of command lines in the past (ms dos, amiga dos, BASIC programming etc), just not a linux command line. All I've ever done is mount a few drives, use nmap and started x
View 1 Replies
View Related
Mar 29, 2009
I was using Red Hat 7.3 forever and decided it was time for a change. I went to Fedora 10 but it was really buggy. CentOS 5.2 is VERY stable.Here is my problem.The server is command line only -- I tend to hate GUI"S.I setup Samba no problem disabling the ports needed through the firewall and that was straightforward.CUPS is a nightmare for me since CentOS locks down the cupsd.conf and then the firewall does its thing. I allowed port 631 through the firewall but then got lost on the cupsd.conf. It's been too long and the old redhat one won't work with CentOS (not surprising since it's a VERY old system) straight-forward CUPS tutorial for a command line interface. I just need it to be:
a) do this
b) do that
View 4 Replies
View Related
Dec 28, 2010
Whenever I try and use php from the command line, I get this message:PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/imagick.so' - /usr/lib64/php/modules/imagick.so: cannot open shared object file: No such file or directory in Unknown on line 0The problem isn't the missing module, it is the warming message itself -- it is breaking scripts that rely on the output.I tried shutting off errors, changed my error reporting to:
error_reporting = E_ALL & ~E_NOTICE | E_CORE_WARNING | E_COMPILE_WARNING
And:
display_startup_errors = Off
Doesn't seem to matter though - it is almost like it isn't using the php.ini file at all
View 4 Replies
View Related
Jan 22, 2011
I just got done installing Ubuntu Server 10.04 on a home server. Now what should I do? I was hoping to have 3 computers connected to it so that we can all share files wirelessly if that's possible.Does Ubuntu Server have a GUI or command line only?
View 9 Replies
View Related
Feb 14, 2011
I am accessing a linux server remotely from my putty. I started the server and now I want to close the command line. when I do cntr+c or cntr+z it kills my server aswell. how will I close my terminal without closing my server? I tried cntr +d but it is not doing anything
View 2 Replies
View Related
Sep 12, 2010
I want to send a simple mail from my terminal
I'm using opensuse and a Know that I have postfix installed...
I don't know what I need configure first...
I know that I need a SMTP server to send e-mails write?
When I try send e-mail with the command mail I received this message :
Code:
mail -s "meeting reminder" -c professorgenival@hotmail.com micromerces@gmail.com
mailq:
Code:
(host mx4.hotmail.com [65.55.92.168] refuse to talk to me: 421 cannot conect to SMTP server.
I was reading about fetchmail But I can't understand....
View 4 Replies
View Related
Oct 6, 2010
Running: Red Hat Enterprise Linux Server 5.2 (Tikanga) I need to be able to automate transferring a few files over from one server to another using scp or the sftp protocol. I have received a text file which looks like a key file along with username and passphrase information for the target server in question.
Instructions were given to me to import the provided text file in puttyGen then save the imported key as a private key to be used by scp or sftp. My assumption is this is for windows utilities, which I am not using. My frustration comes in trying to automate logging into this server via sftp or scp to automate some file transfers. I am asked for a password every time because the public and private key methods failed to find my keys. How can I call scp or the sftp utilities and use the provided key file (the one I generated using puttyGen or the original one provided to me) to login to this server? I've tried taking the generated ppk file from puttygen and adding it with the ssh-add command but that still did not work.
View 4 Replies
View Related
Feb 26, 2010
I install software called Sunflow v0.07.2 in my Ubuntu. When I try to run it,it says
"API error : JVM available memory is below 800 MB (found 728 MB only). Please make sure you launched the program with the -Xmx command line options". What is that xmx command line.What should i do to run Sunflow.
View 2 Replies
View Related
Dec 17, 2009
I am calling another executable in my application (C programing) using "system" command
which is user interactive program. now i want to pass those args in system command only.
system(" executable ");
Executable will expect 1,2 or 3.
1 is to continue
2 for do changes in settings
3 exit from application
how to pass these in to system command
View 1 Replies
View Related
Mar 22, 2011
I need to install a command line server without gui and smallest as possible Is there a option on installer to obtain a minimal server?
View 4 Replies
View Related
Feb 17, 2010
I am trying to install webmin on my server(9.10) by command line
what is the command to see if it is installed or not
View 9 Replies
View Related
Apr 30, 2010
I am trying to install a printer server in the command line.
Does anyone know of good tutorials? or could explain it to me.
I already have cups installed. I just need to install the correct driver which is the Canon MP180 and set it to share.
View 4 Replies
View Related
May 13, 2010
how to unpack a .deb file on server, I tried tar, but doesn't work
View 4 Replies
View Related
Jan 27, 2011
I have just got myself up and running on a ubuntu 32 bit server with postfix using this guide here [URL]...at-ispconfig-3 and everything is working great ( i didnt install ispconfig )
I want to get a command line mail client running but I am having some permission issue.
sudo aptitude install heirloom-mailx
then when i type mail this happens
mail
/var/mail/jj: Permission denied
i also tried mutt etc but always get permission denied.
View 6 Replies
View Related