Cecil Westerhof wrote: > I have a crontab job which uses a SQLite database. Sometimes this database > is locked because I used SQLite DB Browser, but did not Write or Revert > Changes. It looks like that when a database is locked there is a file with > the database name with -journal appended to it. Can I count on this?
The -journal file exists when there is some changed data that might need to be rolled back. It is possible for the DB to be locked before some changed data is actually written. In WAL mode, there is no journal. (And if your job is read only, it then would not be blocked by concurrent writes.) > Then I could write a script to warn me about the lock. You could use SQLite to check whether the DB is locked: if ! sqlite3 my.db "begin immediate"; then echo "is locked" fi Regards, Clemens