What is the best CLI tool (preferably Linux based) that will allow concatenating video files, and also compressing them on the client-side for YouTube upload?
Thanks
I need to run an app at startup/login on my mac. I want it to launch in the background and start doing it's work without interrupting me or me having to start it up because I invariably forget and then when I need it, it wasn't running!
I have tried using AppleScript to tell Terminal to run it and type my password in, but it ends up opening multiple Terminal windows and not working. Ideally I need a script that I can just add to the user login items and it will run for me.
The app has no way of taking a password argument either and it has a password as well as the sudo! I need a solution that can either be done as an applescript (which can be made into an executable) or i need a commandline script but I have no idea about them.
This is the manual code I type
$ sudo serverStatus
password:123456
password:serverpass
My AppleScript:
tell application Terminal
activate
do shell script "sudo serverStatus"
delay 5
do shell script "123456"
delay 2
do shell script "serverpass"
end tell
Is there an environment variable in Windows 7 that is set to the name of the currently running script when I run a script?
I'm looking for the Windows equivalent of the Linux variable $0.
Thanks!
In debian/ubuntu
I want to
a) create a list of all the files in one directory tree
b) do the same for a second directory tree
c) compare the two lists such that, only the file NAMES are compared (i.e. just comparing the "file.txt" part so that "/home/folder/file.txt" == "/home/secondfolder/folder/file.txt)
d) output a list of all the duplicates
can anyone please explain how to do this using scripting languages or regex or something?
I'm writing an installer and need to change all users' wallpaper. I can do this from the group policy editor GUI, but need to do so from my installer. I can't just edit the registry as it gets reset by a GPO on login.
How do I apply the relevant administrative template via programatically (preferably cmd.exe or via the registry)?
(for interest, it's User Configuration Administrative Templates Desktop Desktop Desktop Wallpaper [sic]
Any help would be appreciated.
Thanks!
The accepted answer of this question Fast Ways of Cd'ing on *nix? mentions bash having CDPATH
is there an equivalent in windows?
so from any directory e.g. c:\windows
I could do c:\windowscd compbar* and it'd take me to m:\a\b\c\d\e\compbar
what if there are many compbar directories? well, the CDPATH solution is one solution, I suppose you order them it'd search through the CDPATH environment variable and choose the first.
I'd like that for windows.
Any ideas what I did wrong here? I copied this script from a tutorial and get this error....
PS C:\Windows\system32> Get-Service | Where-Object ($_.status -eq "running")
Where-Object : Cannot bind parameter 'FilterScript'. Cannot convert value "False" to type "System.Management.Automation
.ScriptBlock". Error: "Invalid cast from 'System.Boolean' to 'System.Management.Automation.ScriptBlock'."
At line:1 char:27
+ Get-Service | Where-Object <<<< ($_.status -eq "running")
+ CategoryInfo : InvalidArgument: (:) [Where-Object], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.WhereObjectCommand
I have a cron that makes a backup of MySql, if I execute on shell it works pretty well even if I'm logged when cron supposed to execute works fine, but if I'm not logged just won't execute, I don't know what could happened, any suggestion ?
Crontab
00 04 * * * /home/administrador/scripts/respaldo.sh
respaldo.sh
#!/bin/sh
mysql -uroot -p[PASS] ccs < /home/administrador/scripts/limpia.sql
mysqldump -uroot -p[PASS] --routines ccs > /home/administrador/backups/backup_$(date +%Y%m%d).sql
mysqlcheck -uroot -p[PASS] --auto-repair --optimize ccs
cd /home/administrador/backups/
tar -zcf backup_$(date +%Y%m%d).tgz backup_$(date +%Y%m%d).sql
rm backup_$(date +%Y%m%d).sql
find -name '*.tgz' -type f -mtime +90 -exec rm -f {} \;
respaldo.sh has execute permission
SOLUTION
The problema was that the /home/adminsitrador directory was an encrypted folder so when the user is logged in the folder it's decrypted and everything works but when the user it's logged off the folder it's encrypted and the cron can't access to that path, so I've changed the cron script and backup to another unencrypted folder and to root user and now everything it's working pretty well, thanks to all for your help !
I try to setup a VPN Connection from a Ubuntu 12.04 LTS to Microsoft VPN Server (Ubuntu is the Client in this Case),
but I only get this error message:
.. connection failed! Check the log messages below for information why.
Couldn't open the /dev/ppp device: Operation not permitted
FATAL: Module ppp_generic not found./usr/sbin/pppd: Sorry - this system lacks PPP kernel support
Details you may need:
modprobe -v ppp > FATAL: Module ppp not found.
uname -r -> 2.6.32-042stab076.8
I need to copy a file from a Windows 2003 server to a WebDAV folder (on the same server, if it matters). This operation will be performed via a batch script executed via Scheduled Tasks. I've enabled the WebClient service on the server.
So far I've determined that I can do it like this:
net use x: http://host/path
copy c:\path\myfile.txt x:
net use x: /delete
1) Is there a simpler way than creating a temporary mapped drive? Will it work via a batch file when no user is logged in?
2) Is there anything I should know about enabling the WebClient service on my server? Previously it was disabled, which I assume is default.
In the following code, I need to take the path and size of folder and subfolders into a file. But when the loop runs for the second time, path and size are not getting printed to the file. size.txt only contains the path and size of the 1st folder. Please somebody help me.
@echo off
SETLOCAL EnableDelayedExpansion
SET xsummary=
SET xsize=
for /f "tokens=1,2 delims=C" %%i IN ('"dir /s /-c /a | find "Directory""') do (echo C%%j >> abcd.txt)
for /f "tokens=*" %%q IN (abcd.txt) do (
cd "%%q"
For /F "tokens=*" %%h IN ('"dir /s /-c /a | find "bytes" | find /v "free""') do Set xsummary=%%h
For /f "tokens=1,2 delims=)" %%a in ("!xsummary!") do set xsize=%%b
Set xsize=!xsize:bytes=!
Set xsize=!xsize: =!
echo.%%q >> size.txt
echo.!xsize! >> size.txt
)
I frequently have to do this. For example:
$ vim /etc/pam.d/sudo
$ vim /etc/pam.d/sudo-i
$ cd /etc/pam.d/ # Figure I should just go to the directory
Now, is there a way I could obtain the directory of the last argument when it's a file path?
I'm asking this cause I recently became aware of the $_ variable that has become useful. Was wondering if there's some other commandline fu that might come in handy.
I have read through some suggestions but I am just not technical enough to get this I think.
I am a CAD designer and each file has 5 files associated with it. I have 3 sets of 5 files, and each set needs to go into its own zip file, placed on a separate server.
For example:
"C:\Program Files\7-zip\7z.exe" a file1.zip "O:\server2\map files\BC\BC.d*"-0
"C:\Program Files\7-zip\7z.exe" a file2.zip "O:\server2\map files\BC\ON.d*"-0
"C:\Program Files\7-zip\7z.exe" a file3.zip "O:\server2\map files\BC\AB.d*"-0
and I am in directory "S:\server\map files\provinces" (for example).
These lines run within an existing batch file and by the time it reaches the 3 lines above, it's in the S: directory sample above. So it's looking on my pc for the 7-zip program, creating 3 zip file names which it does, but places those zip files on a separate server which it doesn't and the first zip file also includes all the other 10 files, the second zip file the same plus the first zip file, and the third the same with the other two zip files making me think the code isn't recognizing the part after file1.zip where I am trying to tell it what files to include and where to place the zip files.
Ultimately, I want to either have the system create a new zip file if the old one was deleted, or copy the new files into the existing zip and overwrite any older files, and for these zip files to be placed in a separate location which is where we share our files with other personnel from within our company. The S: drive is for all originals, and O: is for sharing.
Is there a list of all switching options with many different samples?
I'd like to write a simple script that alerts me if a log changes. For this I'm using grep to find the lines I'm interested in. Right now it works like this:
grep line /var/log/file | mail -s Log [email protected]
Problem is that this sends a mail even if no matching lines are found. The mail utility from mailutils seems to have no switch telling it to drop mails that have an empty body.
Is there a quick and easy way to do so?
My scenario is simple - I am copying script samples from the Mercurial online book (at http://hGBook.red-bean.com) and pasting them in a Windows command prompt. The problem is that the samples in the book use single quoted strings. When a single quoted string is passed on the Windows command prompt, the latter does not recognize that everything between the single quotes belongs to one string.
For example, the following command:
hg commit -m 'Initial commit'
cannot be pasted as is in a command prompt, because the latter treats 'Initial commit' as two strings - 'Initial and commit'. I have to edit the command after paste and it is annoying.
Is it possible to instruct the Windows command prompt to treat single quotes similarly to the double one?
EDIT
Following the reply by JdeBP I have done a little research. Here is the summary:
Mercurial entry point looks like so (it is a python program):
def run():
"run the command in sys.argv"
sys.exit(dispatch(request(sys.argv[1:])))
So, I have created a tiny python program to mimic the command line processing used by mercurial:
import sys
print sys.argv[1:]
Here is the Unix console log:
[hg@Quake ~]$ python 1.py "1 2 3"
['1 2 3']
[hg@Quake ~]$ python 1.py '1 2 3'
['1 2 3']
[hg@Quake ~]$ python 1.py 1 2 3
['1', '2', '3']
[hg@Quake ~]$
And here is the respective Windows console log:
C:\Workpython 1.py "1 2 3"
['1 2 3']
C:\Workpython 1.py '1 2 3'
["'1", '2', "3'"]
C:\Workpython 1.py 1 2 3
['1', '2', '3']
C:\Work
One can clearly see that Windows does not treat single quotes as double quotes. And this is the essence of my question.
Had one years ago (on Win 3.1 or '95, I'm not sure). Anyways, it was a really simple program. Stood somewhere in PATH and enabled you to do something of a kind
calc 5 + 28.3*sqrt(12)
and it spit out the result.
Anyone know of any such these days? Doesn't need to do anything fancy ... maybe it would just be nice if it had support for exponentials, but that's it.
Anyone?
p.s. Not interested in full blown solutions like Python or MATLAB.
i'm thinking if does exist some kind of software that can put in a queue a bunch of windows commands... for example i can say to first copy some file somewhere, then rename those, then delete the old files, then edit one of them etc.... without waiting the effective execution of any of those passages.... this could be useful when copying big files that take a lot and i don't want to sit in front of the computer keeping the eyes on the progress bar... does exist anything like this?
I need to run an app at startup/login on my mac. I want it to launch in the background and start doing it's work without interrupting me or me having to start it up because I invariably forget and then when I need it, it wasn't running!
I have tried using applescript to tell terminal to run it and type my password in, but it ends up opening multiple Terminal windows and not working. Ideally I need a script that I can just add to the user login items and it will run for me.
The app has no way of taking a password argument either and it has a password as well as the sudo! I need a solution that can either be done as an applescript (which can be made into an executable) or i need a commandline script but I have no idea about them.
This is the manual code I type
>sudo serverStatus
>password:123456
>password:serverpass
Not sure if this is the right stack to ask, but I have no idea now and it's above my head!
Thanks :D
My applescript:
tell application Terminal
activate
do shell script "sudo serverStatus"
delay 5
do shell script "123456"
delay 2
do shell script "serverpass"
end tell
I use telnet to connect my client, and try to use the edit a file. But I find that I can't edit it. I can't use "Alt" key to control the application. How can I solve it? (Can't install any programme on the client.)
I'm working on some system admin automation using fabric and I'd like to be able to monitor the number of packages that need upgrading on a given machine. This is the same information that I can see when I first log in to a machine, i.e. this part:
35 packages can be updated.
22 updates are security updates.
Is there a command that I can run (preferably without sudo) that gives just that information?
I'd also like to know whether or not apg/dpkg thinks that the machine needs a reboot after packages are installed/upgraded. bybobu shows this at the bottom of the screen. That way I can decide whether or not to reboot machines after I update packages a bit more intelligently.
I've looked at the apt-python bindings, but they seem to have a high learning curve and they also appear to be changed around a lot -- I'd like something that will work at least as far back as lucid without needing to do different things on different Ubuntu versions.
There is an option in the Sound Preferences dialog, Sound Effects tab, to toggle Alert volume 'mute'. It works and suffices for my needs to disable the irritating system beep/bell.
However, I reinstall systems a LOT for testing purposes and would like to set this setting in a shell script so it's off without having to fiddle with a GUI. But for the life of me I can't seem to find where this can be toggled via a command line tool.
I've scanned through gconf-editor, pulseaudio's pacmd, grepped through /etc, even dug through the gnome-volume-control source code, but I am not seeing how this can be set.
I gather that gnome-volume-control has changed since a few releases ago.
Ideas?
There is an option in the Sound Preferences dialog, Sound Effects tab, to toggle Alert volume 'mute'. It works and suffices for my needs to disable the irritating system beep/bell.
However, I reinstall systems a LOT for testing purposes and would like to set this setting in a shell script so it's off without having to fiddle with a GUI. But for the life of me I can't seem to find where this can be toggled via a command line tool.
I've scanned through gconf-editor, pulseaudio's pacmd, grepped through /etc, even dug through the gnome-volume-control source code, but I am not seeing how this can be set.
I gather that gnome-volume-control has changed since a few releases ago. I'm using Natty fwiw.
Ideas?
The text "search and replace" utility programs I've seen, seem to only search on a line-by-line basis...
Is there a command-line tool which can locate one block of lines (in a text file), and replace it with another block of lines.?
For example: Does the test file file contain this exact group of lines:
'Twas brillig, and the slithy toves
Did gyre and gimble in the wabe:
All mimsy were the borogoves,
And the mome raths outgrabe.
'Beware the Jabberwock, my son!
The jaws that bite, the claws that catch!
Beware the Jubjub bird, and shun
The frumious Bandersnatch!'
I want this, so that I can replace multiple lines of text in a file and know I'm not overwriting the wrong lines.
I would never replace "The Jabberwocky" (Lewis Carroll), but it makes a novel example :)