How to let Supervisord wait 1 second before restarting my program?
It spent more than half an hour. Finally, I found this solution.... very simple!
#!/bin/bash
/usr/local/bin/noip2 -c /usr/local/etc/no-ip2.conf
sleep 1
noip sucks!
It spent more than half an hour. Finally, I found this solution.... very simple!
#!/bin/bash
/usr/local/bin/noip2 -c /usr/local/etc/no-ip2.conf
sleep 1
noip sucks!
Two bash script achieved the goals in this subject.
cat utils/exportDbDictionary
if [ $# != 2 ] ; then
echo "USAGE: $0 dbname tablename"
echo " e.g.: $0 IDServer AspNetUsers"
exit 1;
fi
document_path=/YourProjectName/documents/database
[ -d $document_path/$1 ] || mkdir -p $document_path/$1
mysqlshow $1 $2 | sed 's/+/|/g' | sed '1,2d' | sed '$d' | awk -F"[|]" '{print $2"|"$3"|"$5"|"$6"|"$7"|"$10}' | sed 's/ *$//g' > $document_path/$1/$2.md
People should always add comments to their field definitions. As soon as the definition of a table has been done, run this script could automatically generate a markdown table with the name of tableName.md.
cat utils/backupDbStructure
backupFile=/YourProjectName/documents/database/databaseStructure.sql
mysqldump -d --databases YourDB1 YourDB2 YourDB3 | sed 's/ AUTO_INCREMENT=[0-9]*//g' > $backupFile
When you made some changes to your database, run backupDbStruture script will automatically generate the latest table structure into one file. You could commit it later with your code change together.
If the field names in your Model class are not exactly the same as in a JSON string, you will need adding an option to guarantee the behavior is what you want. For example, if you have got the following response text:
{"hello":"world"}
and you have a Model class below:
class SampleModel
{
public string Hello { get; set; };
}
You can see the property name in your Model class is "Hello" instead of "hello", the following code won't get an expecting result.
SampleModel s = JsonSerializer.Deserialize<SampleModel>("{\"hello\":\"world\"}");
you will get an object like
{
"Hello": null
}
You have to use an option below to get it to work.
SampleModel s = JsonSerializer.Deserialize<SampleModel>("{\"hello\":\"world\"}", new JsonSerializerOptions
{
PropertyNameCaseInsensitive = true,
});
on the other hand, you have to use the following code to guarantee the serialize behavior:
SampleModel s = JsonSerializer.Serialize(new SampleModel() {Hello="world"}, new JsonSerializerOptions
{
DictionaryKeyPolicy = JsonNamingPolicy.CamelCase
});
Thus you get {"Hello":"world"} instead of {"hello":"world"}.
System.text.json sucks.
I watched this film with Eric today evening. Gladly, he loves this film.
sudo timedatectl set-timezone Asia/Shanghai
add the line below to [mysqld] section in /etc/my.cnf
default=time-zone = "+8:00"