You are not logged in.

#1 2005-04-30 22:04:17

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

PKGBUILD and daemon start script question.

I am wondering about what the appropriate resolution to the following issue is. I have a temporary solution, but I am not sure if it is appropriate.

Here is the problem.

The lighttpd daemon can compress files for delivery (think apache mod_deflate). A temp directory needs to be specified, so the compressed file can be stored there for quick redelivery. This is held in the 'compress.cache' variable in the lighttpd.conf file.

The problem is, I wanted to specify a subdirectory of the tmp dir, "/tmp/lighttpd/cache". This directory is not created by the daemon itself, and must be preexisting, or an error is produced. Upon server reboot, the contents of /tmp is wiped.

I have temporarily added the following to the "start" stanza of my /etc/rc.d/lighttpd file:

DAEMON_CONF="/etc/lighttpd/lighttpd.conf"
COMPRESS_DIR=`cat ${DAEMON_CONF} | grep -e "^compress.cache" | grep -oe "/.*/"`

_*snip*_

if [ ! -z "$COMPRESS_DIR" ] && [ ! -d "$COMPRESS_DIR" ]; then
  mkdir -p -m777 $COMPRESS_DIR
fi

The above works, and creates the dir if it does not exit. My question is, is this an appropriate and correct solution? Would it be better to adjust the daemon to use the top level /tmp directory?


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#2 2005-04-30 22:24:19

Xentac
Forum Fellow
From: Victoria, BC
Registered: 2003-01-17
Posts: 1,797
Website

Re: PKGBUILD and daemon start script question.

I would leave it the way it is.  An init script can do certain initialization things before it starts the daemon, like the mysql script does.  Just as long as those things aren't things that should be done inside the package and won't break if done repeatedly (yours won't be executed repeatedly because of the if statement).


I have discovered that all of mans unhappiness derives from only one source, not being able to sit quietly in a room
- Blaise Pascal

Offline

#3 2005-04-30 22:50:46

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: PKGBUILD and daemon start script question.

So, by leave it the way it is, I assume you mean the change I made was warrented?


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#4 2005-05-01 01:02:35

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: PKGBUILD and daemon start script question.

I wouldn't auto create the dir - it'll fail with some message saying "compress module can't find cache dir" or something to that effect

Offline

#5 2005-05-01 01:22:28

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: PKGBUILD and daemon start script question.

yes, but the point is every reboot it will say it. A side effect of /tmp being erased on every boot. In theory, the daemon itself should "try" to create the directory if it does not exist..But since the daemon does not, I would think it is a reasonable solution.

I am still not positive though. One for and one against so far..


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#6 2005-05-01 07:40:06

swiergot
Member
From: Kraków, Poland
Registered: 2005-01-08
Posts: 145

Re: PKGBUILD and daemon start script question.

I would let the init script create the directory. Another way is to use a directory under /var/cache.

Offline

#7 2005-05-01 07:46:53

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: PKGBUILD and daemon start script question.

hmmmm. /var/cache. I didn't even think about that. Would it be better to put something temporary like a gzip html file cache into /var/cache, or into /tmp?

EDIT: I decided to just add a directory to the /home/lighttpd dir, and call it cache. It was either that of /var/cache/lighttpd. If anyone has a preference or thinks one location is better than another, let me know..
I also moved php-eaccelerator's cache dir to /var/cache/eaccelerator


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#8 2005-05-01 17:02:03

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: PKGBUILD and daemon start script question.

yeah, mine is running with the cache dir next to the "pages" and "log" dir - yeah it's not using tmp... but I don't care...

Offline

#9 2005-05-01 17:44:32

i3839
Member
Registered: 2004-02-04
Posts: 1,185

Re: PKGBUILD and daemon start script question.

Better not to use /tmp, but /var or something else instead. A lot of security holes come from unsafe file handling in /tmp.

Offline

Board footer

Powered by FluxBB