The Deployer

June 2, 2008

Linux I/O Redirection

Filed under: Linux — Lucian Daniliuc @ 14:26

Redirecting the output is useful everywhere, including in php.

By using `exec()` to import a .sql file into mysql, everything goes smoothly. Until you get some errors. Mysql sends the errors it encounters to stderr instead of stdout.

So… you get the command status 1 (something went bad), but no error message, so you don’t even know where to start.

That’s where the linux I/O redirections t come in handy.

To get the error message as well into the output, you have to add the following extra stuff to the end of your command line that is being passed to `exec()`:

2>&1

Now you also get the error messages in your response.

March 3, 2008

Auto-save & backup on EMACS

Filed under: Linux — Lucian Daniliuc @ 09:04

I use emacs on servers with unlimited access (root) but i also use it at work where’s limited access and where I can only modify files (such as apache configuration files files) but not create new ones. And here is where emacs starts complaining.

“Access denied saving backup”. “Cannot auto-save”.

The solution: create a file called .emacs in your home directory with the following content:

;; disable backup
(setq backup-inhibited t)
;; disable auto save
(setq auto-save-default nil)

You’re done. Emacs doesn’t complain anymore.

Powered by WordPress