shell script to create folder daily with time-stamp and push time-stamp generated logs
Date : March 29 2020, 07:55 AM
hop of those help? I have a cron job which runs every 30 minutes to generate log files with time-stamp like this: , Maybe you are looking for a script like this: #!/bin/bash
shopt -s nullglob # this line is so that it does not compain when no logfiles are found
for filename in test*.log; do # Files considered are the ones startign with test and ending in .log
foldername=$(echo "$filename" | awk '{print (substr($0, 5, 8));}'); # The foldername is characters 5 to 13 from the filename (if they exist)
mkdir -p "$foldername" # -p so that we dont get "folder exists" warning
mv "$filename" "$foldername"
echo "$filename $foldername" ;
done
foldername=$(date +%Y%m%d)
mkdir -p /home/app/logs/"$foldername"
sh sample.sh > /home/app/logs/"$foldername"/test$(date +%Y%m%d%H%M%S).log
sh sample.sh > /home/app/logs/$(date +%Y%m%d)/test$(date +%Y%m%d%H%M%S).log
|
Extract Time stamp from a file and create a time stamp directory structure
Date : March 29 2020, 07:55 AM
This might help you Don't use date, which gives you the current date, which may not necessarily be the date encoded in the file name. for f in tag*.txt; do
IFS=_ read _ _ year month day hour _ <<< "$f"
directory="$year/$month/$day/$hour"
mkdir -p "$directory" || exit 1 # Don't continue if this fails
mv "$f" "$directory"
done
|
how to set server time stamp with firestore admin nodejs sdk?
Date : March 29 2020, 07:55 AM
|
Firestore .orderBy Server Time Stamp not working SWIFT
Date : March 29 2020, 07:55 AM
Hope this helps In order to do something like this you will need to create a composite index. When using an error handler in the query you will see that in the error message in the console is a message like this
|
Firebase Firestore Time Stamp (how to implement)
Date : March 29 2020, 07:55 AM
I wish this help you having an issue when trying to document the time of submission (so i can later filter by it) get submitted to firebase. , First, importing firebase should be like this: import firebase from 'firebase/app'
import 'firebase/firestore'
import firebase from 'firebase'
// import 'firebase/firestore' <- you dont need this
// this is an developing mode, so i would recommend the former one
import firebase from 'firebase/app'
import 'firebase/firestore'
var config = {
apiKey: "<API_KEY>",
authDomain: "<PROJECT_ID>.firebaseapp.com",
databaseURL: "https://<DATABASE_NAME>.firebaseio.com",
projectId: "<PROJECT_ID>",
storageBucket: "<BUCKET>.appspot.com",
messagingSenderId: "<SENDER_ID>",
};
const firebaseApp = firebase.initializeApp(config);
firebaseApp.firestore().settings({ timestampsInSnapshots: true })
export default firebaseApp.firestore() // <------ HERE
<script>
import firestore from './your-firebase-setting'
export default {
name: 'SubmitResource'
// blah blah ...
}
</script>
import firebase from 'firebase/app'
import 'firebase/firestore'
var config = {
apiKey: "<API_KEY>",
authDomain: "<PROJECT_ID>.firebaseapp.com",
databaseURL: "https://<DATABASE_NAME>.firebaseio.com",
projectId: "<PROJECT_ID>",
storageBucket: "<BUCKET>.appspot.com",
messagingSenderId: "<SENDER_ID>",
};
const firebaseApp = firebase.initializeApp(config);
firebaseApp.firestore().settings({ timestampsInSnapshots: true })
export { firebaseApp }
export const firestore = firebaseApp.firestore()
<script>
import { firebaseApp, firestore } from './your-firebase-setting'
</script>
|