Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The shell script writes the log file, lacks information, and some can not write? #18

Open
Tinywan opened this issue Jun 2, 2017 · 0 comments

Comments

@Tinywan
Copy link

Tinywan commented Jun 2, 2017

The shell script writes the log file, lacks information, and some can not write

shell script

#!/bin/bash
logs_path="/home/www/bin/"
TIME=`date '+%Y-%m-%d %H:%M:%S'`
GO=$(redis-cli -h 127.0.0.1 -p 63789  -a  tinywan -n 12 get Golang)
echo " Redis Crontab  [ ${TIME} ]:: ${GO}"  >> ${logs_path}crontab_redis_10.log
echo "[$TIME]-[BeginTime]:${GO}" >> ${logs_path}crontab_redis_12.log

crontab_redis_10.log

  • crontab writing
 :: tinywan_golang17-06-02 10:15:30
 :: tinywan_golang17-06-02 10:16:00
 :: tinywan_golang17-06-02 10:16:30
  • I want the result is
  Redis Crontab [ 17-06-02 10:15:30 ] :: tinywan_golang
  • If i do it is the result I want
echo " Redis Crontab [ " $(date '+%Y-%m-%d %H:%M:%S') " ] ::" $GO  >> /home/www/bin/crontab_redis_12.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant