Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Bash script to import PHP session files into redis
export REDISCLI_AUTH=my-supper-strong-password-4-redis-server
TTL=$(( 24 * 3600 ))
# cd "/var/sess"
for i in sess_*; do
ex=$(( $(date +%s) - $(stat -c %Y "$i") + $TTL ))
v=$(cat "$i")
echo "SET $k of len:${#v} EX $ex"
redis-cli SET "$k" "$v" EX $ex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment