Reputation:
I want to create some files in HDFS
dynamically based on the time stamp.
I can do this in Linux and create the files.
TIMESTAMP=`date "+%Y-%m-%d"`
touch /home/$USER/logs/${TIMESTAMP}.success_log
touch /home/$USER/logs/${TIMESTAMP}.fail_log
Is there a way to do this in HDFS
. I would like to use this feature in shell scripts.
Please let me know.
Upvotes: 1
Views: 2617
Reputation: 18300
hdfs dfs -touchz /home/$USER/logs/`date "+%Y-%m-%d"`.success_log
Or in your way,
TIMESTAMP=`date "+%Y-%m-%d"`
hdfs dfs -touchz /home/$USER/logs/${TIMESTAMP}.success_log
Upvotes: 1