ionice
This commit is contained in:
parent
37df18f45d
commit
3d4a757917
@ -26,6 +26,8 @@ Sections:
|
||||
too quickly. Set this too high, and AtOM will not adapt quickly enough to
|
||||
load increase. In both cases, your hard drive will suffer. In my
|
||||
experience, 30 seconds is a good value.
|
||||
* ionice <class> [niceness]: IO-hungry processes will be run with ionice class
|
||||
<class> and niceness [niceness] (if applicable). See man ionice for details.
|
||||
* temporary-directory <directory>: String. Name speaks for itself: this is
|
||||
where FIFOs (for communicating with sqlite) and temporary WAVE files will
|
||||
be created. Note that debug logs (if enabled) will go there too.
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
[general]
|
||||
ionice 3
|
||||
max-load 6
|
||||
load-interval 30
|
||||
temporary-directory %HOME%/.atom/tmp
|
||||
|
||||
@ -23,6 +23,49 @@ getConfigGeneral() {
|
||||
fi
|
||||
unset expr
|
||||
;;
|
||||
'ionice')
|
||||
read class niceness <<<"$value"
|
||||
case $class in
|
||||
1)
|
||||
# real-time class, only root can do that
|
||||
if (( UID ))
|
||||
then
|
||||
echo "IO class 'realtime' is"\
|
||||
"not available to unprivileged"\
|
||||
"users" >&2
|
||||
exit $EIONICE
|
||||
fi
|
||||
if [ -n "$niceness" ] \
|
||||
&& (( niceness >= 0 && niceness <= 7 ))
|
||||
then
|
||||
ionice="ionice -c1 -n$niceness "
|
||||
else
|
||||
echo "Invalid IO priority"\
|
||||
"'$niceness'" >&2
|
||||
exit $EIONICE
|
||||
fi
|
||||
;;
|
||||
2)
|
||||
if [ -n "$niceness" ] \
|
||||
&& (( niceness >= 0 && niceness <= 7 ))
|
||||
then
|
||||
ionice="ionice -c2 -n$niceness "
|
||||
else
|
||||
echo "Invalid IO priority"\
|
||||
"'$niceness'" >&2
|
||||
exit $EIONICE
|
||||
fi
|
||||
;;
|
||||
3)
|
||||
ionice="ionice -c3 "
|
||||
;;
|
||||
*)
|
||||
echo "Invalid ionice parameters $value"\
|
||||
>&2
|
||||
exit $EIONICE
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
'temporary-directory')
|
||||
tempdir="$value"
|
||||
;;
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
#!/bin/bash
|
||||
printConfig() {
|
||||
{
|
||||
echo "General|Config file|$cffile"
|
||||
[ -n "$ionice" ] && echo "|IO Nice|$ionice"
|
||||
cat <<-EOF
|
||||
General|Config file|$cffile
|
||||
|Load|$maxload
|
||||
|Load Interval|$loadinterval
|
||||
|Temp Dir|$tempdir
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
#!/bin/bash
|
||||
decodeMpcdec() {
|
||||
tmpfile="${fileid}mpcdec"
|
||||
commandline=(mpcdec "$sourcepath/$filename" "$tempdir/$tmpfile.wav")
|
||||
commandline=(${ionice}mpcdec)
|
||||
commandline+=("$sourcepath/$filename" "$tempdir/$tmpfile.wav")
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
#!/bin/bash
|
||||
decodeOpusdec() {
|
||||
tmpfile="${fileid}opusdec"
|
||||
commandline=(opusdec "$sourcepath/$filename" "$tempdir/$tmpfile.wav")
|
||||
commandline=(${ionice}opusdec)
|
||||
commandline+=("$sourcepath/$filename" "$tempdir/$tmpfile.wav")
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
decodeSox() {
|
||||
commandline=(sox --single-threaded --temp "$tempdir")
|
||||
commandline=(${ionice}sox --single-threaded --temp "$tempdir")
|
||||
soxoptions_in=''
|
||||
soxoptions_out=''
|
||||
if (( ${destinationnormalize["$destination"]} ))
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
encodeFile::mp3() {
|
||||
lameopts=(lame --quiet -v --abr ${destinationquality[$destination]})
|
||||
lameopts=(${ionice}lame --quiet)
|
||||
lameopts+=(-v --abr ${destinationquality[$destination]})
|
||||
[ -n "$album" ] && lameopts+=(--tl "$album" )
|
||||
[ -n "$artist" ] && lameopts+=(--ta "$artist")
|
||||
[ -n "$genre" ] && lameopts+=(--tg "$genre")
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
encodeFile::opus() {
|
||||
opusencopts=(opusenc --music --quiet)
|
||||
opusencopts=(${ionice}opusenc --music --quiet)
|
||||
opusencopts+=(--bitrate ${destinationquality[$destination]})
|
||||
[ -n "${destinationloss["$destination"]}" ] \
|
||||
&& opusencopts+=(--expect-loss "${destinationloss["$destination"]}")
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
encodeFile::vorbis() {
|
||||
oggencopts=(oggenc -Q -q ${destinationquality[$destination]})
|
||||
oggencopts=(${ionice}oggenc -Q -q ${destinationquality[$destination]})
|
||||
[ -n "$albumartist" ] && oggencopts+=(-c "ALBUMARTIST=$albumartist")
|
||||
[ -n "$album" ] && oggencopts+=(-l "$album")
|
||||
[ -n "$artist" ] && oggencopts+=(-a "$artist")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user