| Line 169: | Line 169: | ||
Or see my example here: http://svn.tylerrick.com/public/ruby/init.d | Or see my example here: http://svn.tylerrick.com/public/ruby/init.d | ||
| + | =Miscellaneous= | ||
| + | =={{section category|Troubleshooting}} <code>Can’t write viminfo file $HOME/.viminfo</code> when doing <code>sudo vim</code> on Debian/Ubuntu== | ||
| + | {{section category|Vim}} | ||
| + | |||
| + | I first noticed this on an Ubuntu box on which I was given root. Whenever I would <code>sudo vim</code> something, it would not have syntax highlighting turned on, even though <code>/root/.vimrc</code> had <code>syntax on</code>. In fact, it looked like it wasn't reading/using the <code>.vimrc</code> file at all. And when I would exit vim, I would get this error: | ||
| + | <pre> | ||
| + | E138: Can’t write viminfo file $HOME/.viminfo! | ||
| + | </pre> | ||
| + | |||
| + | '''{{section category|Solutions|Solution}}''': | ||
| + | |||
| + | Add <code>env_reset</code> to the <code>Defaults</code> line in your <code>/etc/sudoers</code> file. For example: | ||
| + | <pre> | ||
| + | Defaults whatever,some_thing,env_reset | ||
| + | </pre> | ||
| + | |||
| + | Credit for solution: http://stateless.geek.nz/2006/01/24/sudo-upgrade-from-debian-security-changes-env-handling/ | ||
[[Category:Software]] | [[Category:Software]] | ||
GNU/Linux edit (Category edit) .
This is for miscellaneous GNU/Linux tips, including how to use miscellaneous commands that don't require their own sections.
Contents |
$ uname -r 2.6.7-gentoo-r10
$ uname -r 2.6.16-1.2069_FC4smp [Fedora Core 4 Symmetric MultiProcessor]
# uname --help
Usage: uname [OPTION]...
Print certain system information. With no OPTION, same as -s.
-a, --all print all information, in the following order:
-s, --kernel-name print the kernel name
-n, --nodename print the network node hostname
-r, --kernel-release print the kernel release
-v, --kernel-version print the kernel version
-m, --machine print the machine hardware name
-p, --processor print the processor type
-i, --hardware-platform print the hardware platform
-o, --operating-system print the operating system
--help display this help and exit
--version output version information and exit
dmesg
Or: I'm getting a "cannot bind; address/port already in use" error and I'm not sure which process to kill because I don't see anything listed by ps that looks like it would be that port...
(Lance showed me this trick...)
netstat -lnp
Look for the part number that is supposedly already in use; beside it, it show you which process id as well as which program that has tied up / is using that port. And then kill it:
kill -9 21457
Ah yes, that question... one of the question that makes me hesitant to seriously consider switching completely to GNU.
So many choices... if only there were an obvious best choice!
Anyway, there isn't -- each one has its share of pros/cons -- so the best I can do is listen to the advice/recommendations of people I trust.
Ezra recommends Ubuntu for the desktop and Gentoo for the server.
`nohup' runs the given COMMAND with hangup signals ignored, so that the
command can continue running in the background after you log out.
Synopsis:
nohup COMMAND [ARG]...
If standard input is a terminal, it is redirected from `/dev/null'
so that terminal sessions do not mistakenly consider the terminal to be
used by the command. This is a GNU extension; programs intended to be
portable to non-GNU hosts should use `nohup COMMAND [ARG]... </dev/null'
instead.
If standard output is a terminal, the command's standard output is
appended to the file `nohup.out'; if that cannot be written to, it is
appended to the file `$HOME/nohup.out'; and if that cannot be written
to, the command is not run. Any `nohup.out' or `$HOME/nohup.out' file
created by `nohup' is made readable and writable only to the user,
regardless of the current umask settings.
If standard error is a terminal, it is redirected to the same file
descriptor as the (possibly-redirected) standard output.
`nohup' does not automatically put the command it runs in the
background; you must do that explicitly, by ending the command line
with an `&'. Also, `nohup' does not alter the niceness of COMMAND; use
`nice' for that, e.g., `nohup nice COMMAND'.
http://cr.yp.to/daemontools.html
[root@studebaker ~]# yum install gcc
Put this script into file [root@studebaker ~]# ./install_daemontools.sh
#!/bin/sh
#
# install daemontools on fedora/redhat linux
#
# Mike Jackson <mj@sci.fi> 5 NOV 2005
#
#
mkdir /package
chmod 1755 /package
cd /package
wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
tar xzvf daemontools-0.76.tar.gz
rm -f daemontools-0.76.tar.gz
cd admin/daemontools-0.76/src
wget http://www.qmailrocks.org/downloads/patches/daemontools-0.76.errno.patch
patch < daemontools-0.76.errno.patch
cd ..
package/install
That script downloads, compiles, and installs it.
After that, this process will be forever running, watching over everything: root 5069 0.0 0.0 1564 336 ? S 10:54 0:00 svscan /service
Create a file /service/whatever/run: -rwxr--r-- 1 root root 126 Mar 16 11:24 run
That's it! svscan automatically starts the service as soon as it sees that run command.
> ps aux | grep whatever > svstatus /service/whatever/
http://offog.org/code/freedt.html
You can write init.d scripts in bash or even [Ruby (category)]...
Peter Cooper. How to create a UNIX /etc/init.d startup script with Ruby (http://www.rubyinside.com/how-to-create-a-unix-etcinitd-startup-script-with-ruby-250.html).
Or see my example here: http://svn.tylerrick.com/public/ruby/init.d
Can’t write viminfo file $HOME/.viminfo when doing sudo vim on Debian/UbuntuI first noticed this on an Ubuntu box on which I was given root. Whenever I would sudo vim something, it would not have syntax highlighting turned on, even though /root/.vimrc had syntax on. In fact, it looked like it wasn't reading/using the .vimrc file at all. And when I would exit vim, I would get this error:
E138: Can’t write viminfo file $HOME/.viminfo!
[Solution (category)]:
Add env_reset to the Defaults line in your /etc/sudoers file. For example:
Defaults whatever,some_thing,env_reset
Credit for solution: http://stateless.geek.nz/2006/01/24/sudo-upgrade-from-debian-security-changes-env-handling/