Tag Info

New answers tagged

1

Try setting this environment variable before running CPAN: export PERL_MM_USE_DEFAULT=1 It makes perl automatically answer "yes" when CPAN asks "Would you like to configure as much as possible automatically? [yes]" Source


0

This was probably due to .ssh directory or user's home directory not having the correct permissions. Re-creating the users likely fixed that.


1

If you use the "--preserve-env" option to sudo, then GPG in the sudo session will be able to find the gpg-agent running in the native session. Example: sudo --preserve-env YOUR_COMMAND...


0

There isn't an obvious answer, like an option that lets you specify a script to be run if changes were found. However, you could use the --stats flag to generate statistics about what happened, parse them, and make an educated guess. $ rsync -avP --stats src dest sending incremental file list ... Number of files: 10 Number of files transferred: 2 Total ...


1

I use these dodgy options to work around this problem. (My host's public key is regenerated quite often. so this removes the IP and Key check) ssh remoteServerName -l username -o "UserKnownHostsFile=/dev/null" You can also just use this if the Key stays the same but the IP changes: ssh remoteServerName -l username -o "CheckHostIP=no"


0

I solved the problem with creating 'own' delivery script. In fact, dovecot's deliver script is still used and is inside my own one, but before delivering message to mailbox, my script does stuff which I want to achieve. Of course I had to change 'virtual_transport' in main.cf vonfiguration as well as create hook in master.cf file (as I described in the ...


1

Never mind about the networking. It was not even close. The Bad address message comes from the kernel and indicates that a the process attempted to open a terminal (pty/tty) which does not exist. I'm not sure why adding sleep fixed the issue (unreliably), but going back to no-sleep version of my scripts and adding: Defaults !requiretty to /etc/sudoers ...


2

Your script must act like Simple content filter example from Postfix official documentation. After postfix send the email via pipe, you must resubmit it via sendmail command. Snippet from that page Postfix receives unfiltered mail from the network with the smtpd(8) server, and delivers unfiltered mail to a content filter with the Postfix pipe(8) delivery ...


0

Normally, you'll want to re-inject your messages back into postfix from your script, instead of using a content filter, I think a before queue milter might be a better fit for your use case.


0

Because you tagged your question as bash in addition to shell, there is another solution beside grep : Bash has its own regular expression engine since version 3.0, using the =~ operator, just like Perl. now, given the following code: #!/bin/bash DATA="test <Lane>8</Lane>" if [[ "$DATA" =~ \<Lane\>([[:digit:]]+)\<\/Lane\> ]]; then ...


0

2 Things: As stated by @Rory, you need the -o option, so only the match are printed (instead of whole line) In addition, you neet the -P option, to use Perl regular expressions, which include useful elements like Look ahead (?= ) and Look behind (?<= ), those look for parts, but don't actually match and print them. If you want only the part inside the ...


-4

Tested with Ubuntu 14.04 sudo -g www-data [command]


0

I had to export more variables, to be the same as in ec2-user environment. I defined a new script ec2-backup.sh as below: #!/bin/sh export EC2_HOME=/opt/aws/apitools/ec2 export JAVA_HOME=/usr/lib/jvm/jre export AWS_ACCESS_KEY=... export AWS_SECRET_KEY=... export ...


0

In addition to the earlier example of: find -maxdepth 1 -type d -not -name A -not -name "." -exec rm -ir {} \; you can also do: find some/subdir -mindepth 1 -maxdepth 1 -type d -not -name A -exec rm -ir {} \; to avoid having to cd some/subdir first.


0

A suggestion/ optimization, to preceeding anwers: If it is crucial, i'd make the script confirm an OK instead of a fail, for example with a wget "http://yourpage.com/callhome.php?device_id=xxx" and let the webserver deal with checking if there was no call home. (first DB entry with the wget call, then cron check if there was an entry for that machine) ...


-2

pkill will kill anything contained MailSender, maybe your script contain MailSender in its name. Change it.


0

ansible -i hosts -k -m service -a "name=jboss-as state=started" This is what orchestration-tools are for ;)


1

Ugh how frusterating. I figured it out luckily and carefully examining mail.log is what helped. What i had to do. in main.cf I changed the first entry in the mydestination directive to mydomain.com. I had fiddled with after asking and before getting a commend asking for the main.cf file and noticed I was getting different results in mail.log Finally, I ...


1

This has to do with the variable scope in bash. export makes your variable available to subprocesses, see for example: → export BUCKET=foo → env | grep BUCKET 80:BUCKET=foo → PAIL=bar → env | grep PAIL # no output → python -c "import os; print os.environ['BUCKET']" foo → python -c "import os; print os.environ['PAIL']" Traceback (most recent call ...


1

New Linux systems generally will not boot without a functioning bash. If you lost bash and you attempt to reboot you may be (temporarily) blocked out of your system. if you still have an open session skip this next paragraph about booting from a live cd and go right to the following paragraph. otherwise try: If youve lost bash and none of your user ...


0

Since posting the question I have found the same question answered on Stack Exchange: http://unix.stackexchange.com/questions/46789/check-if-script-is-started-by-cron-rather-than-invoked-manually


3

I'm wondering if anyone can come up with a simpler, more efficient algorithm or add any ideas for a better way of accomplishing this. Yep - use rdiff-backup, rsnapshot, or some other option that you don't need to maintain. I'm not being obtuse here. I realize you said you want to write your own code. Sometimes the correct answer here is not what you ...


2

SSH Bash Function Making an ssh function to run something on login like you did, you can do the following: function ssht () { \ssh $@ -t 'tmux a || tmux || /bin/bash' } alias ssh=ssht Adding a \ in front of the ssh temporarily disables the alias. The ssht function stays the same but we add an alias to ssh that point to it. DOWNSIDE: other ...


0

Here's one that creates base64 strings, note that even though they are limited to base64 strings, the padding is removed from them, so you can't decode them, you probably won't need it anyway. cat /dev/urandom | base64 | head -c 5 Replace 5 with the number of chars you'd like. If you however need to decode them for some reason, move base64 to the end of ...


0

Since the answer to my question was posted as a comment instead of an answer, I'm going to answer it myself to help other people find the answer to the question easier. As per Cyrus's recommendation, I changed the above test.sh to: cd /var/www/domain.com/ && /usr/local/bin/wp post create --post-title="test" post-content="testing" ...


0

If you want to handle embedded newlines, multibyte characters, spaces, leading dashes, backslashes and spaces you are going to need something more robust, see this answer: http://superuser.com/a/858671/365691


1

Ah, I figured this out just after posting. The answer (as always) is: add more quotes (: For my example: prefix="foo*" ... later, in some faraway code ... x="foo*bar" # Prints 'bar' since the pattern has double-quotes surrounding it. echo "${x##"$prefix"}"



Top 50 recent answers are included